A
AL
To receive event when focus and/or selection changes in a Word table. I used:
Created class:
Public WithEvents App As Word.Application
Wrote event procedure:
Public Sub App_WindowSelectionChange(ByVal Sel As Selection)
End Sub
Connected declared object with application object:
Dim X As New EventClassModule
Sub Register_Event_Handler()
Set X.App = Word.Application
End Sub
If I manually run the Register_Event_Handler, the connection is made and the
program works. But it will not work when the document opens. If I run
another macro after I run Register_Event_Handler, the connection is lost and
I do not receive the event. What can I do to have the event active when the
document opens and stay active? Thanks.
Created class:
Public WithEvents App As Word.Application
Wrote event procedure:
Public Sub App_WindowSelectionChange(ByVal Sel As Selection)
End Sub
Connected declared object with application object:
Dim X As New EventClassModule
Sub Register_Event_Handler()
Set X.App = Word.Application
End Sub
If I manually run the Register_Event_Handler, the connection is made and the
program works. But it will not work when the document opens. If I run
another macro after I run Register_Event_Handler, the connection is lost and
I do not receive the event. What can I do to have the event active when the
document opens and stay active? Thanks.