Coloque o seguinte código no início de um módulo qualquer:
Código: Selecionar todos
#If VBA7 Then
Public Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
#Else
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
#End If
Deois, coloque o seguinte código no evento Initialize do UserForm:
Código: Selecionar todos
Dim hWnd As Long
Const WS_SYSMENU As Long = &H84C80080
Const WS_MINIMIZEBOX As Long = &H20000
Const WS_MAXIMIZEBOX As Long = &H10000
hWnd = FindWindow(vbNullString, Me.Caption)
SetWindowLong hWnd, -16, WS_SYSMENU Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX