![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
according to help Dim Obj As New Class1 ' Associate an event handler with an event. AddHandler Obj.Ev_Event, AddressOf EventHandler is the way to go, so I tried oBook = oExcel.Workbooks.Add ' Associate an event handler with an event. AddHandler oBook.WorkbookBeforeClose, AddressOf xlApp_WorkbookBeforeClose and I got Error 4 'WorkbookBeforeClose' is not an event of 'Microsoft.Office.Interop.Excel.Workbook'. |
#3
| |||
| |||
|
|
Hi, according to help Dim Obj As New Class1 ' Associate an event handler with an event. AddHandler Obj.Ev_Event, AddressOf EventHandler is the way to go, so I tried oBook = oExcel.Workbooks.Add ' Associate an event handler with an event. AddHandler oBook.WorkbookBeforeClose, AddressOf xlApp_WorkbookBeforeClose and I got Error 4 'WorkbookBeforeClose' is not an event of 'Microsoft.Office.Interop.Excel.Workbook'. The event is fired from the Application object. So you would need something like AddHandler oExcel.WorkbookBeforeClose, AddressOf xlApp_WorkbookBeforeClose Assuming that oExcel is of type Excel.Application. -- SvenC |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |