Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2005

Tip: Looking for answers? Try searching our database.

What event occurs on form load?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JFW - 25 Oct 2005 00:23 GMT
I am trying to make some things happen when my user form loads in Word 2002.
I have tried FormName_Load and FormName_Initialize, but neither seem to
produce the effect desired. For example, consider a userform that you bring
up, and at initialization you want it to make some checks and based on these
render certain controls non visible. This is what I am trying to do.  Thanks
for your help.
Tony Jollans - 25 Oct 2005 01:13 GMT
The Events (to go in the userform's class module are UserForm_Initialize
(and perhaps UserForm_Activate depending on what you want to do) - that is
"UserForm", not the Userform Name. If you're unsure of events you can select
them via the dropdowns at the top of the code window.

--
Enjoy,
Tony

> I am trying to make some things happen when my user form loads in Word 2002.
> I have tried FormName_Load and FormName_Initialize, but neither seem to
> produce the effect desired. For example, consider a userform that you bring
> up, and at initialization you want it to make some checks and based on these
> render certain controls non visible. This is what I am trying to do.  Thanks
> for your help.
Jay Freedman - 25 Oct 2005 01:15 GMT
>I am trying to make some things happen when my user form loads in Word 2002.
>I have tried FormName_Load and FormName_Initialize, but neither seem to
>produce the effect desired. For example, consider a userform that you bring
>up, and at initialization you want it to make some checks and based on these
>render certain controls non visible. This is what I am trying to do.  Thanks
>for your help.

There are two event procedures that fire when a userform's .Show
method is called.

The first one is named UserForm_Initialize. (It doesn't contain the
actual name of the userform, but the constant string "UserForm".) This
event occurs before the dialog box appears on screen.

The second one is named UserForm_Activate, and it occurs every time
the dialog appears on the screen. If a control on the userform calls
Me.Hide and then other code calls the .Show method again before the
userform is unloaded, UserForm_Activate will fire again.

The UserForm_Initialize event is the one you usually want. For some
purposes either event will do equally well. You must use the _Activate
event for things that have to be reinitialized for each reappearance.

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.