View Single Post
 
Old 09-25-2023, 12:41 PM
vivka vivka is offline Windows 7 64bit Office 2016
Expert
 
Join Date: Jul 2023
Posts: 293
vivka is on a distinguished road
Default

Hi! Try this:
Code:
Sub ITALICS()
    For Each myRng In ActiveDocument.StoryRanges
        Do
            With myRng
                Do
                    With .Find
                    .MatchWildcards = False
                    .text = ""
                    .Replacement.text = ""
                    .Font.Italic = True
                    .Wrap = wdFindStop
                    .Execute
                    End With
                    If .Find.found Then
                        MsgBox myRng.text
'Replace with Style:
                        myRng.Style = "Italic"
                    Else: Exit Do
                    End If
                    myRng.Collapse 0
                Loop
            End With
            Set myRng = myRng.NextStoryRange
        Loop Until myRng Is Nothing
    Next myRng
End Sub
I am not sure if the Italic style used in the code is built-in or created by me previously. Anyway, you can create your own style to meet all your needs.
Reply With Quote