View Single Post
 
Old 01-20-2024, 09:21 AM
vivka vivka is offline Windows 7 64bit Office 2016
Expert
 
Join Date: Jul 2023
Posts: 302
vivka is on a distinguished road
Default

Hi! I've changed one line for small caps:
Code:
Sub Authors()
'Format all surnames (found according to their specific signs) in the selected range.

Dim rng As range
    Application.ScreenUpdating = False
    Set rng = selection.range
    With rng.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .text = "[Vv]gl. <[A-Z][!A-Z][a-z]@>"
        .Forward = True
        .MatchWildcards = True
        .Wrap = wdFindStop
        While .Execute
            rng.MoveStart unit:=wdCharacter, count:=5
            rng.Font.Italic = True
            rng.Font.SmallCaps = True
            rng.Collapse wdCollapseEnd
        Wend
    End With
    Application.ScreenUpdating = True
    Set rng = Nothing
 End Sub
The code woarks for all names (including those in the list) if they are preceded by 'V/vgl. '. If you have a problem, please, post a sample. I can suggest that there's more than one space before the "faulty" surnames.
Reply With Quote