Late bound event handling

A

Alan Moseley

Hi

I am writing an Excel addin using Visual Studio 2005 via the Shared Add-in
project. I understand that I can handle the WorkbookOpen event of Excel by
the following:-

Imports Microsoft.Office.Interop.Excel
Dim WithEvents objExcel as New Application
Public Sub objExcel_WorkbookOpen(wb as Workbook) Handles objExcel.WorkbookOpen
'Some code here to run when a workbook is opened
End Sub

However, I would like to create objExcel using late binding, ie.

Dim WithEvents objExcel as Object = CreateObject("Microsoft.Excel")

How do I go about handling the WorkbookOpen event now?

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top