View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default EnableEvents doesn't work

Hi Stefi,

'--------------
Public blStop As Boolean

Option Explicit

'--------------


Was intended as

Option Explicit
Public blStop As Boolean

---
Regards,
Norman




"Norman Jones" wrote in message
...
Hi Stefi,

EnableEvents does not work with these controls.

Try using a boolean variable, For example try
something like:

'=============
Private Sub CheckBox1_Click()
If Not blStop Then
'Do something, e.g.:
MsgBox "Hi"
End If
End Sub
'<<=============


In a standard module:
'=============
Public blStop As Boolean

Option Explicit

Public Sub Tester()
blStop = True
ActiveSheet.OLEObjects("CheckBox1").Object.Value = xlOn

End Sub
'<<=============

---
Regards,
Norman



"Stefi" wrote in message
...
Hi All,

I have a checkbox with a CheckBox_Click event. In some cases I want to
change the value of its linked cell (to FALSE) through VBA, and in these
cases I don't want to run CheckBox_Click event code. I set
Application.EnableEvents to FALSE before changing the linked cell value,
but
event code is still executed. How can I avoid it?

Thanks,
Stefi