View Single Post
 
Old 08-13-2014, 08:37 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

You could use something along the lines of:
Code:
Sub InsertTriangleBefore()
    Dim RngDoc As Range, RngFnd As Range, i As Long, TargetList
    TargetList = Array( ... )     ' put list of terms to find here
    For i = 0 To UBound(TargetList)
        Set RngDoc = ActiveDocument.Range
        With RngDoc
            With .Find
                .Text = TargetList(i)
                .Format = True
                .MatchCase = True
                .MatchWholeWord = False
                .MatchWildcards = False
                .MatchSoundsLike = False
                .MatchAllWordForms = False
                .Execute
            End With
            Do While .Find.Found = True
                Set RngFnd = .Duplicate
                With RngFnd
                    .Collapse wdCollapseStart
                    .Text = ChrW(9660)
                    With .Font
                      .Size = 8
                      .Color = 49407
                      .Superscript = True
                      .Subscript = False
                    End With
                End With
                .Collapse wdCollapseEnd
                .Find.Execute
            Loop
        End With
    Next
End Sub
I'd also suggest using rather more frequent line breaks in your array definition...

PS: When posting code, please use the code tags. They're on the 'Go Advanced' tab at the bottom of this screen
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote