I'm trying to get the WorkbookOpen Event to fire so I can run code when a new workbook is opened. Below is the code I'm using and I get a compile error in the highlighted 2 lines. I cannot determine the underlying issue resulting in the compile errors. I'm using VB.net
Any help will be appreciated.
Rich
Imports Microsoft.Office.Interop.Excel
Imports ExcelDna.IntelliSense
Imports ExcelDna.Integration
Imports ExcelDna.Integration.ExcelDnaUtil
Public Class ClsAddIn
Implements IExcelAddIn
Dim applicationEvents As EventTest
<ExcelCommand()>
Sub Start() Implements IExcelAddIn.AutoOpen
IntelliSenseServer.Install()
applicationEvents = New EventTest
'bhm2 =
End Sub
Sub Close() Implements IExcelAddIn.AutoClose
IntelliSenseServer.Uninstall()
End Sub
Public Shared Sub Sub_SelectList()
Dim SelectForm As New Form_Select
SelectForm.ShowDialog()
End Sub
Public Shared Sub Sub_ErrorMessaging()
Dim SelectForm1 As New Form_ErrorMessaging
SelectForm1.ShowDialog()
End Sub
Public Shared Sub Sub_FunctionHelp()
Dim SelectForm2 As New Form_FunctionHelp
SelectForm2.Show()
End Sub
End Class
Public Class EventTest
Dim WithEvents AppEve As application
Public Sub New()
AppEve = ExcelDnaUtil.Application
End Sub
Private Sub AppEve_WorkbookOpen() Handles AppEve.WorkbookOpen
MsgBox("Opened workbook: ")
End Sub
End Class