I have code that enables me to add a minimize button to my userforms, but I don't know the code to tell the userforms to minimize. Can anyone help me with this? I would also need to know the code to make the userform reappear. Here is what I have for adding the minimize button:
In the module window:
In the userform code window:![]()
Private Declare Function FindWindowA Lib "USER32" _ (ByVal lpClassName As String, _ ByVal lpWindowName As String) As Long Private Declare Function GetWindowLongA Lib "USER32" _ (ByVal hWnd As Long, _ ByVal nIndex As Long) As Long Private Declare Function SetWindowLongA Lib "USER32" _ (ByVal hWnd As Long, _ ByVal nIndex As Long, _ ByVal dwNewLong As Long) As Long Sub FormatUserForm(UserFormCaption As String) Dim hWnd As Long Dim exLong As Long hWnd = FindWindowA(vbNullString, UserFormCaption) exLong = GetWindowLongA(hWnd, -16) If (exLong And &H20000) = 0 Then SetWindowLongA hWnd, -16, exLong Or &H20000 Else End If End Sub
Thanks in advance for your help!![]()
Private Sub UserForm_Initialize() Call FormatUserForm(UserForm1.Caption) End Sub











LinkBack URL
About LinkBacks
Register To Reply
Bookmarks