G
GS
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'.
what do I have to do with the handler below to make it work?
Private Sub xlApp_WorkbookBeforeClose(ByVal Wb As Excel.Workbook, _
ByRef Cancel As Boolean)
'Debug.WriteLine("WithEvents: Closing the workbook.")
Wb.Saved = True 'Set the dirty flag to true so there is no prompt to
save
End Sub
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'.
what do I have to do with the handler below to make it work?
Private Sub xlApp_WorkbookBeforeClose(ByVal Wb As Excel.Workbook, _
ByRef Cancel As Boolean)
'Debug.WriteLine("WithEvents: Closing the workbook.")
Wb.Saved = True 'Set the dirty flag to true so there is no prompt to
save
End Sub