Si tu equipo es de 32 bits, utiliza el siguiente código. Lo debes poner al inicio de todo el código de tu Userform, en la sección de General Declaraciones
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) 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 GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Const WS_MINIMIZEBOX As Long = &H20000
Private Const WS_MAXIMIZEBOX As Long = &H10000
Private Const GWL_STYLE As Long = (-16)
Private Const WS_SYSMENU As Long = &H80000 'variable para ocultar el botón x
Después, en el evento initialize
Private Sub UserForm_Initialize() ' Declaración de variantes para los botones de maximizar y minimizar
Dim lngMyHandle As Long, lngCurrentStyle As Long, lngNewStyle As Long
If Application.Version < 9 Then
lngMyHandle = FindWindow("THUNDERXFRAME", Me.Caption)
Else
lngMyHandle = FindWindow("THUNDERDFRAME", Me.Caption)
End If
lngCurrentStyle = GetWindowLong(lngMyHandle, GWL_STYLE)
lngNewStyle = lngCurrentStyle Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX
SetWindowLong lngMyHandle, GWL_STYLE, lngNewStyle
Dim hWnd As Long 'para ocultar el botón "X"
Dim lngWstyle As Long
End Sub
Y en el evento Activate:
Private Sub UserForm_Activate()
'para poner el form a la izquierda y arriba de la pantalla
Me.Top = 0
Me.Left = 0
End Sub
Si ya tienes los eventos, solamente agrega el código dentro del evento.
Sal u dos
Gracias! - Dante Amor
De nada estimado. - Abraham Valencia