Event when a user form is loaded

  • Thread starter Thread starter shashi1515
  • Start date Start date
S

shashi1515

I am using Excel 2000 and I want some event to triger whenever my user
form is loaded.

Ex: I have a user form with 6 edit boxes and I want to enable only few
edit boxes depending on the situation at which the user form is
called.

How should I capture the event the user form is loaded. Please help.

Thanks,
Shashi
 
Hi,
have the various procedures that initialize the form pass to your
userform initialize code something you can use to test it--something
like:
'Public myTest as boolean
If myTest1 = True then UserForm1.TextBox1.Enabled = True

HTH--Lonnie M.
 
Hi Shashi,

You can use the userform_initialize event in your userform code window ...

Private Sub Userform_Initialize()
'your code here..
End Sub

HTH
 
The user for will have a couple of events that will do what you wnat. There
is initialize which is the code which runs the first time the userform is
loaded. The second event is activate which is the code that is run each time
the userform is loaded. Add these event to the uer form (select them from the
drop down menus in the code for the userform) and add a message box to them
something like this...

Private Sub UserForm_Activate()
MsgBox "Activate"
End Sub

Private Sub UserForm_Initialize()
MsgBox "Initialize"
End Sub
 

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

Back
Top