View Single Post
 
Old 05-29-2022, 07:10 AM
stky stky is offline Windows 10 Office 2013
Advanced Beginner
 
Join Date: Apr 2021
Posts: 30
stky is on a distinguished road
Default

Ok i will check that for stories.

but can check where i mistake in the below code.

Sub EmDash()
Dim rngStory As Range
For Each rngStory In ActiveDocument.StoryRanges
Dim MyList() As String
Dim i As Long
Options.DefaultHighlightColorIndex = wdTurquoise
MyList = Split("—,[ ]{1,}—[ ]{1,}")
For i = 0 To UBound(MyList())
Set r = ActiveDocument.Range
With rngStory.Find
.Text = MyList(i)
.Replacement.Text = "^32—^32"
.MatchWildcards = True
.MatchCase = True
.Replacement.Highlight = wdTurquoise
.Execute Replace:=wdReplaceAll
End With
Next
Next
End Sub
Reply With Quote