Private Declare Function FindWindow& Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName$, ByVal lpWindowName$)
Private Declare Function SetWindowLong& Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd&, ByVal nIndex&, ByVal dwNewLong&)
Private Declare Function ShowWindow& Lib "user32" _
(ByVal hwnd&, ByVal nCmdShow&)
Private Declare Function GetWindowLong& Lib "user32" Alias "GetWindowLongA" _
(ByVal hwnd&, ByVal nIndex&)
Private Const GWL_STYLE As Long = -16
Private Const GWL_EXSTYLE As Long = -20
Private Const WS_MINIMIZEBOX As Long = &H20000
Private Const WS_EX_APPWINDOW As Long = &H40000
Private Const WS_EX_DLGMODALFRAME As Long = &H1
Dim hwnd&
Private Sub UserForm_Activate()
Dim WStyle&
WStyle& = GetWindowLong(hwnd&, GWL_STYLE) Or WS_MINIMIZEBOX
SetWindowLong hwnd&, GWL_STYLE, WStyle&
ShowWindow hwnd&, 0
WStyle& = WS_EX_APPWINDOW + WS_EX_DLGMODALFRAME
SetWindowLong hwnd&, GWL_EXSTYLE, WStyle&
ShowWindow hwnd&, 1
End Sub
Private Sub UserForm_Initialize()
hwnd& = FindWindow(vbNullString, Me.Caption)
End Sub
Private Sub CommandButton1_Click()
Unload Me
End Sub