Hey all,

Is it possible to assing a userform in vba to a 2nd monitor / screen?

i had a nice code of Leith Ross (well know in this forum)

it publish the userform correctly in fullscreen but only with a small 3px white frame
this is his code:
'Returns the Window Handle of the Window that is accepting User input.
 Public Declare Function GetForegroundWindow Lib "user32.dll" () As Long

 Private Declare Function GetWindowLong _
   Lib "user32.dll" _
     Alias "GetWindowLongA" _
       (ByVal hwnd As Long, ByVal nIndex As Long) As Long
               
 Private Declare Function SetWindowLong _
  Lib "user32.dll" _
    Alias "SetWindowLongA" _
      (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Sub RemoveFrame()

  Dim Bitmask As Long
  Dim hwnd As Long
  Dim WindowStyle As Long
  
  Const GWL_STYLE As Long = (-16)
  Const WS_DLGFRAME As Long = &H400000
  
    hwnd = GetForegroundWindow
    WindowStyle = GetWindowLong(hwnd, GWL_STYLE)

    Bitmask = WindowStyle And (Not WS_DLGFRAME)

    Call SetWindowLong(hwnd, GWL_STYLE, Bitmask)

End Sub

Sub RestoreToolbars()
Application.ScreenUpdating = False

On Error GoTo 0
ActiveWindow.DisplayHeadings = True

With Application
.DisplayFullScreen = False
End With
With ActiveWindow
.DisplayHorizontalScrollBar = True
.DisplayVerticalScrollBar = True
.DisplayWorkbookTabs = True
End With
End Sub
This code remove everything for full screen show but with a 3pixel white frame.

when i put this extra code in, it removes the white line and moves the form over my excel worksheet. (because the Me.)
With Application
    Me.Top = .Top
    Me.Left = .Left
    Me.Height = .Height
    Me.Width = .Width
End With
is there a solution to make this always go to other screen?