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)metaintegration.net> wrote in message
news:dcde5765-459c-4ae2-9662-5923600666b7(a)m7g2000prd.googlegroups.com...
> 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
you...

I have a class module CExcelEvents which starts:

Option Compare Text ' Makes string compare always be case-
insensitve
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...
Thx
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' (http://www.cpearson.com/excel/AppEvent.aspx)) not
working.

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()
ThisWorkbook.Workbook_Open
End Sub


Hope this helps.


--
lesco_quartz
------------------------------------------------------------------------
lesco_quartz's Profile: http://www.thecodecage.com/forumz/member.php?userid=1198
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=148822

[url=&quot;http://www.thecodecage.com&quot;]Microsoft Office Help[/url]