Thread: Disable events
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Disable events

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