View Single Post
 
Old 01-20-2024, 10:11 AM
landrob1 landrob1 is offline Mac OS X Office 2016 for Mac
Novice
 
Join Date: Jan 2024
Posts: 9
landrob1 is on a distinguished road
Default

Quote:
Originally Posted by vivka View Post
This seems to work:
Code:
Sub FormatAuthorNamesInSmallCaps()

Dim rng As range
Dim authorNames As Variant

Application.ScreenUpdating = False
    Set rng = ActiveDocument.range

'Liste der Autorennamen
    authorNames = Array("Ackermann", "Angermann", _
    "Andersen", "Atzeni", "Baecker", "Ortmann", _
    "Zamoyski", "Ziegler", "Wurzbach", "Zittel", _
    "Zürcher", "Zytphen-Adeler")

    For i = 0 To UBound(authorNames)
        With rng.Find
            .ClearFormatting
            .Replacement.ClearFormatting
            .text = authorNames(i)
            .Forward = True
            .Wrap = wdFindStop
            .MatchWholeWord = True
            While .Execute
                rng.Font.Italic = True
                rng.Font.SmallCaps = True
                rng.Collapse wdCollapseEnd
            Wend
        End With
    Next i
Application.ScreenUpdating = True
End Sub
Thx a lot!!!!
Reply With Quote