M
Mark F.
The following code is supposed to color all the quoted text brown. When
the first double quotes character is found, the text is colored from
that point on! I am having difficulty understanding the parameters for
the various "Selection" objects and how their parameters act on the
document's selection.
' Begin code ==========================
Public Function ColorizeQuotedText()
Dim nWordPos As Integer
On Error Resume Next
With ActiveDocument.Words
For nWordPos = 1 To .Count
If .Item(nWordPos).Characters.First.Text = """" Then
.Item(nWordPos).Select
' Bug! ==================================
Selection.Extend character:=""""
Selection.MoveLeft Unit:=wdWord, Count:=-1,
Extend:=wdExtend
' =======================================
Selection.Find.Format = True
Selection.Font.Color = wdColorBrown
End If
Next nWordPos
End With
End Function
' =====================================
Thanks in advance for your help!
(c:
the first double quotes character is found, the text is colored from
that point on! I am having difficulty understanding the parameters for
the various "Selection" objects and how their parameters act on the
document's selection.
' Begin code ==========================
Public Function ColorizeQuotedText()
Dim nWordPos As Integer
On Error Resume Next
With ActiveDocument.Words
For nWordPos = 1 To .Count
If .Item(nWordPos).Characters.First.Text = """" Then
.Item(nWordPos).Select
' Bug! ==================================
Selection.Extend character:=""""
Selection.MoveLeft Unit:=wdWord, Count:=-1,
Extend:=wdExtend
' =======================================
Selection.Find.Format = True
Selection.Font.Color = wdColorBrown
End If
Next nWordPos
End With
End Function
' =====================================
Thanks in advance for your help!
(c: