Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Public gThisApp As New clsApplication
Yep, that was the trick. Strange that it ever worked... Probably some kind of unwanted side effect. Regards --alexT |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Application level event help | Excel Discussion (Misc queries) | |||
where is the workbook_open event handler??? | Excel Programming | |||
different IDispatch in event handler | Excel Programming | |||
Cell Event Handler | Excel Programming | |||
Monitoring application-level event problem | Excel Programming |