G
Greg Maxey
I have a document template with the following code:
A standard project module:
Option Explicit
Private myDynamicMenu As myClass1
Sub AutoOpen()
Set myDynamicMenu = New myClass1
End Sub
A Class Module (myClass1):
Option Explicit
Private WithEvents mWordApp As Word.Application
Private Sub Class_Initialize()
Set mWordApp = Word.Application
End Sub
Private Sub mWordApp_WindowSelectionChange(ByVal oSel As Selection)
MsgBox "Test"
End Sub
When I change the selection the Msgbox fires.
When I try to use this template as an AddIn, the Msgbox doesn't fire.
I am thinking that this is because the class isn't initialized when the
AddIn is loaded. How do I modify this code so that if this code was in an
AddIn and the AddIn is loaded then I would see the message box every time
the selection is changed?
Thanks.
A standard project module:
Option Explicit
Private myDynamicMenu As myClass1
Sub AutoOpen()
Set myDynamicMenu = New myClass1
End Sub
A Class Module (myClass1):
Option Explicit
Private WithEvents mWordApp As Word.Application
Private Sub Class_Initialize()
Set mWordApp = Word.Application
End Sub
Private Sub mWordApp_WindowSelectionChange(ByVal oSel As Selection)
MsgBox "Test"
End Sub
When I change the selection the Msgbox fires.
When I try to use this template as an AddIn, the Msgbox doesn't fire.
I am thinking that this is because the class isn't initialized when the
AddIn is loaded. How do I modify this code so that if this code was in an
AddIn and the AddIn is loaded then I would see the message box every time
the selection is changed?
Thanks.