From: Rick Rothstein on 28 Oct 2009 16:57
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
> It does NOT work.
>> Application.EnableEvents = True
> 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 28 Oct 2009 18:31
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
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 18 Nov 2009 09:53
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
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
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()
Hope this helps.
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="http://www.thecodecage.com"]Microsoft Office Help[/url]
First | Prev |
Pages: 1 2
Prev: Cannot seem to Cancel EXCEL App Right Click Event using C#
Next: Sorting Data