P
Peter
Hello,
I am trying to hook to the NewWorkbook Event in Excel but I am unable to
hook to the event. The following code:
Excel.Application appExcel = new Excel.Application();
Excel.AppEvents_NewWorkbookEventHandler excelevent;
excelevent = new Excel.AppEvents_NewWorkbookEventHandler(ExcelNewWorkbook);
appExcel.NewWorkbook += excelevent; // COMPILER ERROR
generates the following error:
Cannot implicitly convert type
'Microsoft.Office.Interop.Excel.AppEvents_NewWorkbookEventHandler' to
'Microsoft.Office.Core.NewFile'
Property or indexer
'Microsoft.Office.Interop.Excel._Application.NewWorkbook' cannot be assigned
to -- it is read only
It appears that Excel.Application.NewWorkbook is not event despite MS
documentation:
Private Sub object_NewWorkbook(ByVal Wb As Workbook)
object An object of type Application declared with events in a class
module. For more information, see Using Events with the Application Object .
Wb The new workbook.
Any Ideas?
Many Thanks
Peter
I am trying to hook to the NewWorkbook Event in Excel but I am unable to
hook to the event. The following code:
Excel.Application appExcel = new Excel.Application();
Excel.AppEvents_NewWorkbookEventHandler excelevent;
excelevent = new Excel.AppEvents_NewWorkbookEventHandler(ExcelNewWorkbook);
appExcel.NewWorkbook += excelevent; // COMPILER ERROR
generates the following error:
Cannot implicitly convert type
'Microsoft.Office.Interop.Excel.AppEvents_NewWorkbookEventHandler' to
'Microsoft.Office.Core.NewFile'
Property or indexer
'Microsoft.Office.Interop.Excel._Application.NewWorkbook' cannot be assigned
to -- it is read only
It appears that Excel.Application.NewWorkbook is not event despite MS
documentation:
Private Sub object_NewWorkbook(ByVal Wb As Workbook)
object An object of type Application declared with events in a class
module. For more information, see Using Events with the Application Object .
Wb The new workbook.
Any Ideas?
Many Thanks
Peter