From: Rick Rothstein on
Maybe I need to ask what you mean by "event callbacks"... can you describe
what you mean by this and, perhaps, show us some of your non-working code so
we can see exactly how you are trying to proceed?

Rick (MVP - Excel)

"ras" <ras(a)> wrote in message
> It does NOT work.
>> Application.EnableEvents = True
> This
> a) is not disabled by stopping in the middle of running a macro
> b) does NOT re-enable events.
> If event callbacks stop, I have NO WAY to start them without
> restarting Excel.
> This is the problem I'm trying to solve.

From: ras on
Thx. I got it- it "should" work. I guess that means it works for

I have a class module CExcelEvents which starts:

Option Compare Text ' Makes string compare always be case-
Option Explicit ' Make code require variable declaration
Private WithEvents XLApp As Application

' Called when the selection changes, eg, by selecting a different
cell on the sheet
Private Sub XLApp_SheetSelectionChange(ByVal sh As Object, ByVal
Target As Range)
dim i as integer
i = 3
end sub

This is called whenever the selection changes, unless I've stopped in
the debugger and quit.
For instance, put a breakpoint at i=3. Select a cell- it stops at
this line. Hit the Reset (square) button.
Select a different cell- the breakpoint is not hit.
Write a sub foo() containing:
Application.EnableEvents = True
Put a breakpoint at the above line. Hit F5. Before the line is
executed, I put the mouse over "EnableEvents" and vis-studio tells me
it's already true.
Hit F5 to continue.
Select a different cell- the original breakpoint is not hit...
From: lesco_quartz on

Hi - I had the same problem. Resetting after an error left the
SheetSelectionChange event handling I implemented in an Add In (see
'Application Events' ( not

The work around was to relaunch Excel. Here's how I fixed it ...

In my Add in ThisWorkbook code I have:

Private XLApp As CExcelEvents

Public Sub Workbook_Open()
Set XLApp = New CExcelEvents
End Sub

I found that if you run this Workbook_Open sub after an error the event
triggering works again. In my vb app I added a menu item that called it
so the user can fix it.

Private Sub ResetEvents()
End Sub

Hope this helps.

lesco_quartz's Profile:
View this thread:

[url=&quot;;]Microsoft Office Help[/url]