T
TCook
Hey All,
Just wondering if anyone else has experienced the same bug that I have in MS
Word:
Create a single class module called WordEventClass as follows:
Option Explicit
Private WithEvents m_appWord As Word.Application
Private Sub Class_Initialize()
Set m_appWord = Word.Application
End Sub
Private Sub Class_Terminate()
Set m_appWord = Nothing
End Sub
Private Sub m_appWord_WindowSelectionChange(ByVal Sel As Selection)
MsgBox "SelectionChange"
End Sub
Now create a regular module as follows:
Option Explicit
Private MyClass As WordEventClass
Sub starter()
Dim pPara As Word.Paragraph
Set MyClass = New WordEventClass
For Each pPara In Selection.Paragraphs
Debug.Print pPara.LeftIndent
Debug.Print pPara.RightIndent
Debug.Print
pPara.Range.Information(wdHorizontalPositionRelativeToPage)
Debug.Print pPara.Range.Information(wdActiveEndPageNumber)
Next pPara
End Sub
Notice how the 'WindowSelectionChange' event fires like crazy???
It appears that reading LeftIndent, RightIndent and Information fires the
'WindowSelectionChange' event... and how is this going to negatively affect
performance???
Does anyone have any experience with this?
It's easy enough to avoid within one's own solutions via setting some flag
to skip the 'WindowSelectionChange' code but when there may be other 3rd
party tools involved, it could get ugly in a hurry.
Thoughts?
Just wondering if anyone else has experienced the same bug that I have in MS
Word:
Create a single class module called WordEventClass as follows:
Option Explicit
Private WithEvents m_appWord As Word.Application
Private Sub Class_Initialize()
Set m_appWord = Word.Application
End Sub
Private Sub Class_Terminate()
Set m_appWord = Nothing
End Sub
Private Sub m_appWord_WindowSelectionChange(ByVal Sel As Selection)
MsgBox "SelectionChange"
End Sub
Now create a regular module as follows:
Option Explicit
Private MyClass As WordEventClass
Sub starter()
Dim pPara As Word.Paragraph
Set MyClass = New WordEventClass
For Each pPara In Selection.Paragraphs
Debug.Print pPara.LeftIndent
Debug.Print pPara.RightIndent
Debug.Print
pPara.Range.Information(wdHorizontalPositionRelativeToPage)
Debug.Print pPara.Range.Information(wdActiveEndPageNumber)
Next pPara
End Sub
Notice how the 'WindowSelectionChange' event fires like crazy???
It appears that reading LeftIndent, RightIndent and Information fires the
'WindowSelectionChange' event... and how is this going to negatively affect
performance???
Does anyone have any experience with this?
It's easy enough to avoid within one's own solutions via setting some flag
to skip the 'WindowSelectionChange' code but when there may be other 3rd
party tools involved, it could get ugly in a hurry.
Thoughts?