Thread: Disable events
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Nigel Nigel is offline
external usenet poster
 
Posts: 923
Default Disable events

Thanks Jim, I was pulling my hair out trying to figure out why things were
behaving the way they were. Your reply clears it up. Many thanks

--
Cheers
Nigel



"Jim Cone" wrote in message
...
Hello Nigel,

I am taking a guess as to the why of your question...
Application.EnableEvents has no effect on controls in a UserForm.
A solution is to use a Public variable say...blnDisable.
Set the value of the variable to true when you what to stop form events.
Then in the code for each control you can use something like...

Private Sub CommandButton1_Click()
If blnDisable Then exit Sub

'or if you want to keep track
' If blnDisable Then
' Counter = Counter + 1
' Exit Sub
' End if

'other stuff
End Sub

Regards,
Jim Cone
San Francisco, USA
Free add-ins...
http://www.realezsites.com/bus/primitivesoftware


"Nigel"
wrote in message

I am using Application.EnableEvents to stop userform controls being active
during file processing activity. I then re-enable them after the process

is
complete.
Can someone advise if the control activities are recorded in a buffer or

in
some way can be captured - even though they do not fire any code attached

to
them?
Cheers
Nigel