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 GetWindowLong Lib "User32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Const GWL_STYLE As Long = (-16) 'The offset of a window's style Public Sub toto(F As Object) hWnd = FindWindow(vbNullString, F.Caption) iStyle = GetWindowLong(hWnd, GWL_STYLE) Or &H70000 SetWindowLong hWnd, GWL_STYLE, iStyle End Sub
Private Sub UserForm_Initialize() toto Me End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question'Dans le module du UserForm
Option Explicit
Private HandleUF&
Private Sub UserForm_Initialize()
Const WS_MAXIMIZEBOX& = &H10000, _
WS_MINIMIZEBOX& &H20000, GWL_STYLE& -16&
HandleUF = FindWindow(vbNullString, Me.Caption)
SetWindowLong HandleUF, GWL_STYLE, _
GetWindowLong(HandleUF, GWL_STYLE) Or WS_MAXIMIZEBOX Or WS_MINIMIZEBOX
BaseUFProc = SetWindowLong(HandleUF, GWL_WNDPROC, BaseUFProc)
End Sub
Private Sub UserForm_Terminate()
SetWindowLong HandleUF, GWL_WNDPROC, BaseUFProc
End Sub
réduise tout le classeur Excel et non pas seulement le formulaire (comme le code de départ)