S
Sahana
I m trying to make the macros to indicate there should be no space
before and after an em dash. But i m unable to get the execution
right. Below is the code. let me know whats wrong.
Sub Spacesemdash()
Dim oRng As Range
Selection.HomeKey Unit:=wdStory
With Selection.FInd
.ClearFormatting
.Wrap = wdFindStop
''' .Text = "^="
.Text = "ChrW(8212)"
Do While .Execute
Set oRng = Selection.Range
With oRng
.MoveEnd Unit:=wdCharacter, Count:=1
.MoveStart Unit:=wdCharacter, Count:=-1
With .Characters
If .Last = " " Or .First = " " Then
ActiveDocument.comments.Add _
Range:=oRng, _
Text:="There should be no spaces before or
after an em dash."
End If
End With
End With
Loop
End With
End Sub
before and after an em dash. But i m unable to get the execution
right. Below is the code. let me know whats wrong.
Sub Spacesemdash()
Dim oRng As Range
Selection.HomeKey Unit:=wdStory
With Selection.FInd
.ClearFormatting
.Wrap = wdFindStop
''' .Text = "^="
.Text = "ChrW(8212)"
Do While .Execute
Set oRng = Selection.Range
With oRng
.MoveEnd Unit:=wdCharacter, Count:=1
.MoveStart Unit:=wdCharacter, Count:=-1
With .Characters
If .Last = " " Or .First = " " Then
ActiveDocument.comments.Add _
Range:=oRng, _
Text:="There should be no spaces before or
after an em dash."
End If
End With
End With
Loop
End With
End Sub