Application level event handler broken in 2003SP1 ?

  • Thread starter Thread starter Alex T
  • Start date Start date
A

Alex T

Folks

I have a pretty standard class I use to trap application events

-----------------------------------------------------------------
Option Explicit
Public WithEvents myApp As Excel.Application

Private Sub myApp_WorkbookBeforeClose(ByVal Wb As Workbook, Cancel As Boolean)

' - Traps the close event

' DO STUFF

End Sub
-----------------------------------------------------------------

Which I initialize using this code snippet

-----------------------------------------------------------------
Public gThisApp As clsApplication
Set gThisApp.myApp = Excel.Application
-----------------------------------------------------------------

Resulting in the following error

I'm pretty sure this was working just fine before applying 2003SP1...

Am I missing something obvious ? Any pointer ?

Thanks & regards

--AlexT
 
Try changing
Public gThisApp As clsApplication

to
Public gThisApp As New clsApplication
 
I think you have to set gThisApp = New clsApplication first. I believe
that is the object it is referring to.
 
Public gThisApp As New clsApplication

Yep, that was the trick.

Strange that it ever worked... Probably some kind of unwanted side effect.

Regards

--alexT
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top