I am trying to move quotes before punctuation with a Word macro, but apart from an error in the code here below, I cannot find a way to swap characters without using 'Selection.' Can someone help? Thanks! Here's the code:
Quote:
'VBA Quotes Before Punctuation
Application.ScreenUpdating = False
Dim myRng As Word.Range, myChr
For Each myRng In ActiveDocument.StoryRanges 'Text and Footnotes
Do
For Each myChr In myRng.Characters
If myChr.Text Like "[,;.:?]" _
And myChr.First.Next.Text Like "[«‹›»" & Chr(39) & Chr(34) & Chr(146) & Chr(148) & "]" Then
'Revert without using "Selection."
End If
Next
Set myRange = myRange.NextStoryRange
Loop Until myRange Is Nothing
Next
|