View Single Post
 
Old 03-28-2016, 09:00 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,375
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

Quote:
Originally Posted by rpb925 View Post
That is mind boggling. It's so concise.
Nah, it's verbose! Consider:
Code:
Sub Demo()
Dim arrTerms(), i As Long
arrTerms = Array("italics", "bold", "indent")
With ActiveDocument.Range.Find
    .MatchWildcards = True
    .Replacement.Text = "\3"
    For i = 0 To UBound(arrTerms)
        .Replacement.ClearFormatting
        .Text = "(\<" & arrTerms(i) & ")(\>)(*)\1/\2"
        Select Case i
            Case 0: .Replacement.Font.Italic = True
            Case 1: .Replacement.Font.Bold = True
            Case 2: .Replacement.ParagraphFormat.LeftIndent = 72
        End Select
        .Execute Replace:=wdReplaceAll
    Next
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote