T
Tim
ExtendMode being turned off by WindowSelectionChange event
I have a class that contains a WindowSelectionChange event.
Whenever the event is triggered, the ExtendMode is being turned
off before the event routine is completed. This event is also affecting
the functionality of the F2 (MoveText) and the Format Painter functionality.
I can Email the test template to anyone that is interested in looking
at it ([email protected]) or it can be setup as follows:
Steps to setup test template
1. Create a Class module call ProcClass with the following contents:
Option Explicit
Public WithEvents MyWord As Word.Application
Private Sub MyWord_WindowSelectionChange(ByVal Sel As Selection)
iClassTrigger = iClassTrigger + 1
StatusBar = " Class triggered: " & CStr(iClassTrigger) & ", ExtendMode: "
& _
Selection.ExtendMode
End Sub
2. Create a code module with the following contents
Option Explicit
Public wdApp As New ProcClass
Public iClassTrigger As Integer
Sub AutoOpen()
Set wdApp.MyWord = Word.Application 'Initializes Class
End Sub
'These last 2 routines aren't required
Sub DestroyClass() 'Destroys Class
Set wdApp.MyWord = Nothing
End Sub
Sub CheckClass() 'Re-initializes Class if not found
If wdApp.MyWord Is Nothing Then
Set wdApp.MyWord = Word.Application
End If
End Sub
3. Save the template and then re-open it.
The statusbar will display incrementally the number of times the event was
triggered and the ExtendMode status.
If ExtendMode is ON, the ExtendMode will be turned off when the ChangeEvent
is completed.
Thanks in advance for your time looking at this.
I have a class that contains a WindowSelectionChange event.
Whenever the event is triggered, the ExtendMode is being turned
off before the event routine is completed. This event is also affecting
the functionality of the F2 (MoveText) and the Format Painter functionality.
I can Email the test template to anyone that is interested in looking
at it ([email protected]) or it can be setup as follows:
Steps to setup test template
1. Create a Class module call ProcClass with the following contents:
Option Explicit
Public WithEvents MyWord As Word.Application
Private Sub MyWord_WindowSelectionChange(ByVal Sel As Selection)
iClassTrigger = iClassTrigger + 1
StatusBar = " Class triggered: " & CStr(iClassTrigger) & ", ExtendMode: "
& _
Selection.ExtendMode
End Sub
2. Create a code module with the following contents
Option Explicit
Public wdApp As New ProcClass
Public iClassTrigger As Integer
Sub AutoOpen()
Set wdApp.MyWord = Word.Application 'Initializes Class
End Sub
'These last 2 routines aren't required
Sub DestroyClass() 'Destroys Class
Set wdApp.MyWord = Nothing
End Sub
Sub CheckClass() 'Re-initializes Class if not found
If wdApp.MyWord Is Nothing Then
Set wdApp.MyWord = Word.Application
End If
End Sub
3. Save the template and then re-open it.
The statusbar will display incrementally the number of times the event was
triggered and the ExtendMode status.
If ExtendMode is ON, the ExtendMode will be turned off when the ChangeEvent
is completed.
Thanks in advance for your time looking at this.