View Single Post
 
Old 05-01-2017, 07:13 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

OK, but you could have some additional code to conditionally enable/disable the WindowSelectionChange event. For example, in your normal code module:
Code:
Public bMon As Boolean

Sub LoadMonitor()
    Set selMonitor = New Class1
    Call EnableMonitor
End Sub

Sub EnableMonitor()
    bMon = True
    MsgBox "Selection Change On"
End Sub

Sub DisableLoadMonitor()
    bMon = False
    MsgBox "Selection Change Off"
End Sub
This both initiates and enables the WindowSelectionChange event and allows you to conditionally enable/disable it.

Then all you need do is add a single line to the WindowSelectionChange sub:
Code:
Private Sub mWordApp_WindowSelectionChange(ByVal Sel As Selection)
If bMon = False Then Exit Sub
'code here for selection change
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote