S
Sahana
Hi I m trying to detect the presence of double space. I got the code
as well but the macros doesnt really highlight the double spaces
(using comments) at every instance. It just kinda highlights with some
blue highlight mark. Anyways I need some macros to detect double IF
WORDS ARE PRESENT BEFORE AND AFTER the DOUBLE space.
Example,
I have ten pots.
Macros should detect the double spaces.
If something like this is present like
ARTICLE
then macros should not detect the double spaces here.
Macros are
Sub Spacesemdash()
Dim oRng As Range
Selection.HomeKey Unit:=wdStory
With Selection.FInd
.ClearFormatting
.Wrap = wdFindStop
.Text = " "
Do While .Execute
Set oRng = Selection.Range
With oRng
.MoveEnd Unit:=wdCharacter, Count:=1
.MoveStart Unit:=wdCharacter, Count:=-1
'With .Characters
If .Last = "[a-z]" Or .First = "[a-z] " Then
ActiveDocument.comments.Add _
Range:=oRng, _
Text:="There should be no spaces before or
after an en dash."
End If
End With
End With
Loop
End With
End Sub
Pls tell me where modifications are to be done
as well but the macros doesnt really highlight the double spaces
(using comments) at every instance. It just kinda highlights with some
blue highlight mark. Anyways I need some macros to detect double IF
WORDS ARE PRESENT BEFORE AND AFTER the DOUBLE space.
Example,
I have ten pots.
Macros should detect the double spaces.
If something like this is present like
ARTICLE
then macros should not detect the double spaces here.
Macros are
Sub Spacesemdash()
Dim oRng As Range
Selection.HomeKey Unit:=wdStory
With Selection.FInd
.ClearFormatting
.Wrap = wdFindStop
.Text = " "
Do While .Execute
Set oRng = Selection.Range
With oRng
.MoveEnd Unit:=wdCharacter, Count:=1
.MoveStart Unit:=wdCharacter, Count:=-1
'With .Characters
If .Last = "[a-z]" Or .First = "[a-z] " Then
ActiveDocument.comments.Add _
Range:=oRng, _
Text:="There should be no spaces before or
after an en dash."
End If
End With
End With
Loop
End With
End Sub
Pls tell me where modifications are to be done