Last active
November 25, 2019 15:45
-
-
Save brentmaxwell/41e90dcf7d3a66127c466628a974f77d to your computer and use it in GitHub Desktop.
Swap smart and straight quotes in Microsoft Word
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub ChangeDoubleStraightQuotesToSmartQuotes() | |
Selection.Find.ClearFormatting | |
Selection.Find.Replacement.ClearFormatting | |
With Selection.Find | |
.Text = """" | |
.Replacement.Text = """" | |
.Forward = True | |
.Wrap = wdFindContinue | |
.Format = False | |
.MatchCase = False | |
.MatchWholeWord = False | |
.MatchWildcards = False | |
.MatchSoundsLike = False | |
.MatchAllWordForms = False | |
End With | |
Selection.Find.Execute Replace:=wdReplaceAll | |
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub ChangeSingleStraightQuotesToSmartQuotes() | |
Selection.Find.ClearFormatting | |
Selection.Find.Replacement.ClearFormatting | |
With Selection.Find | |
.Text = "'" | |
.Replacement.Text = "'" | |
.Forward = True | |
.Wrap = wdFindContinue | |
.Format = False | |
.MatchCase = False | |
.MatchWholeWord = False | |
.MatchWildcards = False | |
.MatchSoundsLike = False | |
.MatchAllWordForms = False | |
End With | |
Selection.Find.Execute Replace:=wdReplaceAll | |
End Sub | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub RemoveSmartQuotes() | |
Dim vFindText As Variant | |
Dim vReplText As Variant | |
Dim i As Long | |
vFindText = Array("[^0145^0146]", "[^0147^0148]") | |
vReplText = Array("^039", "^034") | |
With Selection.Find | |
.ClearFormatting | |
.Replacement.ClearFormatting | |
.Forward = True | |
.Wrap = wdFindContinue | |
.MatchWholeWord = True | |
.MatchWildcards = True | |
For i = LBound(vFindText) To UBound(vFindText) | |
.Text = vFindText(i) | |
.Replacement.Text = vReplText(i) | |
.Execute Replace:=wdReplaceAll | |
Next i | |
End With | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment