Launch userform on specific monitor

HOGAN2023

New Member
Joined
Nov 8, 2023
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Hello,

I use 3 monitors in Windows extended desktop configuration (2x 24" and 1x 15" laptop screen).

I'd like to be able to choose the monitor on which my userform will be launched in full screen mode.

A listbox or 3 buttons named respectively "Monitor 1", "Monitor 2" or "Monitor 3" can do the trick.

I tried but failed with the solutions proposed by @Handyman84 and @Jaafar Tribak on this post : New window, move to second screen (using VBA).


Another solution would be to move the userform on the monitor where you want it to launch in full screen mode.
But how do you do this?


I'd really appreciate your help 🙏

Thank you very much.
Vincent
 
This is untried here because I have only a single monitor. See if it works for you :

VBA Code:
Sub Launch_UserForm()
'--Addresses Dual Screen problem by launching Userform in Maximized Application
'  --TopLeft position saved in Userform Properties at Design Time are used
'  --in relation to Maximized Application

    Dim lDsnLeft As Long, lDsnTop As Long
    
    With Application
        If .WindowState <> xlMaximized Then _
            .WindowState = xlMaximized
    End With
    
    With UserForm1
        '---Read UserForm Settings saved at Design Time
        lDsnLeft = .Left
        lDsnTop = .Top
      
        .StartUpPosition = 0
        .Left = Application.Left + lDsnLeft
        .Top = Application.Top + lDsnTop
        .Show
    End With
End Sub

There is additional resource code at : Userform shows up on the wrong monitor
 
Upvote 0
This is untried here because I have only a single monitor. See if it works for you :

VBA Code:
Sub Launch_UserForm()
'--Addresses Dual Screen problem by launching Userform in Maximized Application
'  --TopLeft position saved in Userform Properties at Design Time are used
'  --in relation to Maximized Application

    Dim lDsnLeft As Long, lDsnTop As Long
   
    With Application
        If .WindowState <> xlMaximized Then _
            .WindowState = xlMaximized
    End With
   
    With UserForm1
        '---Read UserForm Settings saved at Design Time
        lDsnLeft = .Left
        lDsnTop = .Top
     
        .StartUpPosition = 0
        .Left = Application.Left + lDsnLeft
        .Top = Application.Top + lDsnTop
        .Show
    End With
End Sub

There is additional resource code at : Userform shows up on the wrong monitor
Don't work unfortunately
 
Upvote 0
Can you elaborate?
Actually, it works in a way, maybe the OP didn't set Left and Top properties so it pops-up top left.
But the OP actually wants to be able to select at runtime a screen on which to display the form. So it's a bit different. For example I am using 3.
 
Upvote 0
Which assuming that your monitors are arranged horizontally should just be a matter of setting the Left property to the desired location, no?
 
Upvote 0
Which assuming that your monitors are arranged horizontally should just be a matter of setting the Left property to the desired location, no?
As a simple shortcut/workaround I guess it can sort of work up to a point, especially if the form has to be maximised.
But then you have some unknowns - which screen holds your application window? each screen size? And assuming horizontal layout, landscape orientation ...
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top