Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 144
Default Userform Initialize

Can someone please explain "Initialize" in when working with Userforms in
Excel? How to implement in Userform? Thank you in advance for help on this.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default Userform Initialize

The initialize event occurs when you LOAD or SHOW a user form e.g.

Load UserForm1

UserForm1.Show

You can put your own code into this event so that you can set up objects on
the UserForm (control defaults etc), other conditions or run other sub
routines that are required to run before the UserForm is loaded into memory
and or show(n) to the user. Each UserForm has its own initialize event which
is stored on the UserForm code sheet. e.g.

Private Sub UserForm_Initialize()
' put code in here to run when the UserForm is load(ed) or show(n)

End Sub

Note that the UserForm reference above is always the same regardless on the
actual UserForm name

--

Regards,
Nigel




"TotallyConfused" wrote in
message ...
Can someone please explain "Initialize" in when working with Userforms in
Excel? How to implement in Userform? Thank you in advance for help on
this.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Userform Initialize

This is not totally correct.

The Initialize event is triggered when the form is loaded, or if a control
on a non-loaded form is referenced.

The Activate is triggered when the form is shown.

So, for a form that is loaded and shown and then hidden and re-shown a
number of times, the Initialize event is fired once, the Activate is fired
each time. For a form that is loaded then unloaded, the re-loaded, unloaded,
etc., the Initialize event and the Activate is fired each time.

Note that if you show a form that has not yet been loaded, it will
automatically load and trigger the Initialize event as well.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Nigel" wrote in message
...
The initialize event occurs when you LOAD or SHOW a user form e.g.

Load UserForm1

UserForm1.Show

You can put your own code into this event so that you can set up objects
on the UserForm (control defaults etc), other conditions or run other sub
routines that are required to run before the UserForm is loaded into
memory and or show(n) to the user. Each UserForm has its own initialize
event which is stored on the UserForm code sheet. e.g.

Private Sub UserForm_Initialize()
' put code in here to run when the UserForm is load(ed) or show(n)

End Sub

Note that the UserForm reference above is always the same regardless on
the actual UserForm name

--

Regards,
Nigel




"TotallyConfused" wrote in
message ...
Can someone please explain "Initialize" in when working with Userforms in
Excel? How to implement in Userform? Thank you in advance for help on
this.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default Userform Initialize

Thanks for the clarity Bob, I should have remembered as I rely on it in some
of my applications! With a hide/unhide of loaded forms, if the initialize
event fired each time my form settings data would be lost!

Cheers

--

Regards,
Nigel




"Bob Phillips" wrote in message
...
This is not totally correct.

The Initialize event is triggered when the form is loaded, or if a control
on a non-loaded form is referenced.

The Activate is triggered when the form is shown.

So, for a form that is loaded and shown and then hidden and re-shown a
number of times, the Initialize event is fired once, the Activate is fired
each time. For a form that is loaded then unloaded, the re-loaded,
unloaded, etc., the Initialize event and the Activate is fired each time.

Note that if you show a form that has not yet been loaded, it will
automatically load and trigger the Initialize event as well.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Nigel" wrote in message
...
The initialize event occurs when you LOAD or SHOW a user form e.g.

Load UserForm1

UserForm1.Show

You can put your own code into this event so that you can set up objects
on the UserForm (control defaults etc), other conditions or run other sub
routines that are required to run before the UserForm is loaded into
memory and or show(n) to the user. Each UserForm has its own initialize
event which is stored on the UserForm code sheet. e.g.

Private Sub UserForm_Initialize()
' put code in here to run when the UserForm is load(ed) or show(n)

End Sub

Note that the UserForm reference above is always the same regardless on
the actual UserForm name

--

Regards,
Nigel




"TotallyConfused" wrote in
message ...
Can someone please explain "Initialize" in when working with Userforms
in
Excel? How to implement in Userform? Thank you in advance for help on
this.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform Initialize [email protected] Excel Programming 4 August 7th 07 06:01 AM
UserForm initialize event run when UserForm is shown [email protected] Excel Programming 2 June 13th 07 02:49 AM
UserForm initialize Arne Hegefors Excel Programming 8 September 8th 06 01:48 PM
userform initialize Patrick Simonds Excel Programming 1 August 4th 06 11:14 PM
initialize userform, using a sub natanz[_2_] Excel Programming 11 November 22nd 05 05:30 AM


All times are GMT +1. The time now is 07:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"