UserForm_Initialize()

S

Senad Isanovic

Need to find more info about the order in which the sub routines for
UserForm events UserForm_Activate(), UserForm_Initialize(), are executed,
which one is executed first and also other events that belongs to the
UserForm object
 
J

Jonathan West

Senad Isanovic said:
Need to find more info about the order in which the sub routines for
UserForm events UserForm_Activate(), UserForm_Initialize(), are executed,
which one is executed first and also other events that belongs to the
UserForm object

The Initialize event is called when the userform is first loaded into
memory. The Activate event occurs when the form is first displayed.

If you display a form simply using the Show method, then the two events fire
one immediately after the other (Initialize first)

However, you can load a form into memory without displaying it, by using the
Load command, like this

Load myForm

or like this, if you don't the default instance, but instead use a separate
object variable

Dim mf as myForm
Set mf = New myForm

This causes the initialize event only to fire. You can then make changes to
myForm (or mf), before using the Show event to display it (which then causes
Activate to fire)

If you subsequently use the Hide method without unloading the form and then
Show the form again, the Activate event will be triggered again when the
form is re-shown.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top