Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Application level event handler broken in 2003SP1 ?

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

Object variable or With block variable not set <<<


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

Am I missing something obvious ? Any pointer ?

Thanks & regards

--AlexT
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Application level event handler broken in 2003SP1 ?

Try changing
Public gThisApp As clsApplication

to
Public gThisApp As New clsApplication

--
Regards,
Tom Ogilvy

"Alex T" wrote in message
om...
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

Object variable or With block variable not set <<<


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

Am I missing something obvious ? Any pointer ?

Thanks & regards

--AlexT



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Application level event handler broken in 2003SP1 ?

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

Alex T wrote:

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


Object variable or With block variable not set <<<



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

Am I missing something obvious ? Any pointer ?

Thanks & regards

--AlexT

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Application level event handler broken in 2003SP1 ?

Public gThisApp As New clsApplication

Yep, that was the trick.

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

Regards

--alexT
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application level event help John Bundy Excel Discussion (Misc queries) 2 January 15th 08 10:30 PM
where is the workbook_open event handler??? Steff_DK[_10_] Excel Programming 2 April 25th 04 02:43 PM
different IDispatch in event handler Dirk[_2_] Excel Programming 0 January 23rd 04 11:04 PM
Cell Event Handler David Excel Programming 3 January 19th 04 04:51 PM
Monitoring application-level event problem R Avery Excel Programming 2 January 6th 04 01:58 PM


All times are GMT +1. The time now is 12:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"