Disabling click and change events in form initialize

P

Peter

Hi,
As with all user forms, if you set the value or state of a control in the
initialize macro, then the corresponding _click or _change event macro will
fire. I am looking for a way to disable this. I want to set the state and
values of controls without firing these macros until after the initialize
macro is done and the form is displayed. Is there a way to do this?

Thanks,
Peter
 
J

Jean-Guy Marcil

Peter said:
Hi,
As with all user forms, if you set the value or state of a control in the
initialize macro, then the corresponding _click or _change event macro will
fire. I am looking for a way to disable this. I want to set the state and
values of controls without firing these macros until after the initialize
macro is done and the form is displayed. Is there a way to do this?

One way around that is to create a global Boolean variable in the user form
module. Set it to false at the beginning of the Initialize event. Then, in
all Click-Change- etc. events put all code in an "IF Not Boolean Then Exit"
type of structure. At the end of the Initialze event, set the Boolean to True.

There maybe a more official-elegant way of doing this, but I have always
used that without any problems.
 
P

Peter

Thank you! While I was looking for the more "official-elegant" way of doing
this, your suggestion has the added advantage that I need use it only for
those click or change event procedures I need.

Thanks again.

Peter
 

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