ich habe eine fertige UserForm die sich dynamisch an meine Monitorgröße 17' und 27 ' automatisch anpasst was auch sehr gut funktioniert. Wenn ich jedoch die Userform auf meinem Laptop Starte ist die Userform zu breit so das man einen Teil nicht mehr sieht.Was auch nicht funktioniert ist das wenn man gleichzeitig auf zwei bildschirmen ist das er es quasi als einen erkennt und die userform praktisch in der mitte landet...
Ich schicke mal meinen Code vllt sieht ja jmd woran das liegt :
Option Explicit
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetFocus Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Const GWL_STYLE As Long = -16
Private Const GWL_EXSTYLE As Long = -20
Private Const WS_CAPTION As Long = &HC00000
Private Const WS_MINIMIZEBOX As Long = &H20000
Private Const WS_MAXIMIZEBOX As Long = &H10000
Private Const WS_POPUP As Long = &H80000000
Private Const WS_VISIBLE As Long = &H10000000
Private Const WS_EX_DLGMODALFRAME As Long = &H1
Private Const WS_EX_APPWINDOW As Long = &H40000
Private Const SW_SHOW As Long = 5
Dim g_hForm As Long
Dim maxi As Boolean
Dim maxiT As Boolean
Dim OldWidth As Single, OldHeight As Single, OldTop As Single, OldLeft As Single
Private Declare Function MapVirtualKey Lib "user32.dll" Alias "MapVirtualKeyA" ( _
ByVal wCode As Long, _
ByVal wMapType As Long) As Long
Private Declare Sub keybd_event Lib "user32.dll" ( _
ByVal bVk As Byte, _
ByVal bScan As Byte, _
ByVal dwFlags As Long, _
ByVal dwExtraInfo As Long)
Private Const KEYEVENTF_KEYUP = &H2
Private Const VK_MENU = &H12
Private Const lngMargin = 1 'Breite der Seitenränder in cm
Private Sub UserForm_Activate()
Dim lngCurrentStyle As Long, lngNewStyle As Long
If Val(Application.Version)