My Excel UserForms contain a variety of objects, including text boxes, combo boxes, radio buttons, etc. The UserForm and the objects on the UserForm shrink and expand when my laptop is on a docking station and the VBA window is open on a larger monitor.
When I access the UserForm editor from the Forms tab in VBA, I can drag the UserForm resize handles and the objects in the UserForm will immediately snap back to their original state, but I want to do this programmatically so that the end user will not deal with shrunken/expanded UserForms.
I have tried resizing the UserForm upon opening (UserForm_Initialize), but it seems as if the shrinking/expanding takes place while the UserForm is not active, meaning that my UserForm resizing only acts to return the UserForm to its shrunken/expanded state and not its original state.
Sub UserForm_Initialize()
Call ResizeUserform(Me)
End Sub
Sub ResizeUserform(UserForm_Name As Object)
UserForm_Name.Width = UserForm_Name.Width + 0.001
UserForm_Name.Width = UserForm_Name.Width - 0.001
UserForm_Name.Height = UserForm_Name.Height + 0.001
UserForm_Name.Height = UserForm_Name.Height - 0.001
End Sub