Hi Lucausa
I'm AnnaThomas and I'd happily help you with your question. In this Forum, we are Microsoft consumers just like yourself.
If you want to keep only the maximize button and exclude the minimize and close buttons on a UserForm, you can modify the MinMax function in your code. You can remove the line iStyle = iStyle Or WS_MINIMIZEBOX to exclude the minimize button.
To exclude the close button, you can set the ControlBox property of the UserForm to False. You can do this in the UserForm’s properties window or in its code module by adding the line Me.ControlBox = False in the UserForm_Initialize event.
Here is an example of how your modified MinMax function and UserForm_Initialize event might look:
Public Sub MinMax(FormCaption As String)
'****Used to show the Maximized button on Userform****
Dim hWndForm As Long
Dim iStyle As Long
If Val(Application.Version) < 9 Then
hWndForm = FindWindow("ThunderXFrame", FormCaption)
Else
hWndForm = FindWindow("ThunderDFrame", FormCaption)
End If
iStyle = GetWindowLong(hWndForm, GWL_STYLE)
iStyle = iStyle Or WS_MAXIMIZEBOX
SetWindowLong hWndForm, GWL_STYLE, iStyle
End Sub
Private Sub UserForm_Initialize()
Me.ControlBox = False
End Sub
I hope this helps ;-), let me know if this is contrary to what you need, I would still be helpful to answer more of your questions.
Best Regards,
AnnaThomas
Give back to the community. Help the next person with this problem by indicating whether this answer solved your problem. Click Yes or No at the bottom.