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

RE: Disabling click and change events in form initialize by JeanGuyMarcil

JeanGuyMarcil
Fri Feb 22 12:59:02 PST 2008

"Peter" wrote:

> 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.

RE: Disabling click and change events in form initialize by Peter

Peter
Mon Feb 25 04:33:01 PST 2008

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

"Jean-Guy Marcil" wrote:

> "Peter" wrote:
>
> > 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.