Microsoft Office Tutorials and References
In Depth Information
A Resizable UserForm
.Top = Me.InsideHeight - .Height
.Left = Me.InsideWidth - .Width
Figure 15-19: The UserForm after being increased in size.
Although the Label control is added at runtime, the event-handler code for the object
is contained in the module. Including code for an object that doesn’t exist does not
present a problem.
This technique relies on these facts:
h The user can move a control on a UserForm (see “A UserForm with Movable Controls,”
earlier in this chapter).
h Events exist that can identify mouse movements and pointer coordinates. Specifically,
these events are MouseDown and MouseMove .
h VBA code can change the size of a UserForm at runtime, but a user cannot.