View Single Post
 
Old 03-22-2022, 02:56 PM
macropod's Avatar
macropod macropod is offline Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I don't see any conversion of:
"This is the text" Citation
to:
Citation ("This is the text")
as described in your first post.

For what is shown in the attached document:
Code:
Sub Demo()
Application.ScreenUpdating = False
With Selection.Paragraphs.First.Range.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Format = False
    .Forward = True
    .Wrap = wdFindStop
    .MatchWildcards = True
    .Text = "[“”\(\[\)\]]"
    .Replacement.Text = ""
    .Execute Replace:=wdReplaceAll
    .Text = Chr(34)
    .Replacement.Text = """"
    .Execute Replace:=wdReplaceAll
    .Text = ". . ."
    .Replacement.Text = "…"
    .Execute Replace:=wdReplaceAll
    .Text = "^s"
    .Replacement.Text = " "
    .Execute Replace:=wdReplaceAll
    .Text = "[ ]{2,}"
    .Replacement.Text = " "
    .Execute Replace:=wdReplaceAll
    .Text = "[^l^13]{1,}"
    .Replacement.Text = "  "
    .Execute Replace:=wdReplaceAll
End With
Application.ScreenUpdating = True
End Sub
Note that, unlike using string manipulations, the above code retains the original formatting.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote