Snowflake
10-09-2012, 10:32 AM
Heya guys!
I was searching for a way to add or remove space after or before quotation marks in the sentence.
I found this
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "([A-z])([""" & ChrW(8220) & "])([A-z])"
.Replacement.Text = "\1 \2\3"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceOne
Selection.Collapse direction:=wdCollapseEnd
If Selection.Find.Found = False Then
MsgBox "First instance of quotation mark not found. Stopping macro."
Exit Sub
End If
With Selection.Find
.Text = "([A-z])([""" & ChrW(8220) & "])([A-z])"
.Replacement.Text = "\1\2 \3"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceOne
Selection.Collapse direction:=wdCollapseEnd
If Selection.Find.Found = False Then
MsgBox "Second instance of quotation mark not found. Stopping macro."
Exit Sub
The problem is when I have a couple of quoted sentences, I have to copy-paste this 10-15 times cause it only works for one set of the quotation marks..:(
Oh well.
Hopefully you can help me here..
TY!
I was searching for a way to add or remove space after or before quotation marks in the sentence.
I found this
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "([A-z])([""" & ChrW(8220) & "])([A-z])"
.Replacement.Text = "\1 \2\3"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceOne
Selection.Collapse direction:=wdCollapseEnd
If Selection.Find.Found = False Then
MsgBox "First instance of quotation mark not found. Stopping macro."
Exit Sub
End If
With Selection.Find
.Text = "([A-z])([""" & ChrW(8220) & "])([A-z])"
.Replacement.Text = "\1\2 \3"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceOne
Selection.Collapse direction:=wdCollapseEnd
If Selection.Find.Found = False Then
MsgBox "Second instance of quotation mark not found. Stopping macro."
Exit Sub
The problem is when I have a couple of quoted sentences, I have to copy-paste this 10-15 times cause it only works for one set of the quotation marks..:(
Oh well.
Hopefully you can help me here..
TY!