G
George Lee
I can't delete a space (ASCII 32) in Word 2003 after a period, any
punctuation mark, and in some instances, for no apparent reason. Why not, and
more importantly, how can they be deleted? The code is the condensed version
and intentionally uses wildcards (there's additional processing that has been
removed) but it still exposes the problem.
Public Sub Macro6()
On Error GoTo MyErrorHandler
Dim whichDocument As Document
Set whichDocument = ActiveDocument
Dim findrange As Range
Set findrange = whichDocument.Range
findrange.Find.ClearFormatting
findrange.Find.MatchWildcards = True
findrange.Find.Text = "*"
While findrange.Find.Execute() = True
findrange.Delete
DoEvents
Wend
Exit Sub
MyErrorHandler:
MsgBox "Macro6" & vbCrLf & vbCrLf & "Err = " & Err.Number & vbCrLf &
"Description: " & Err.Description
End Sub
punctuation mark, and in some instances, for no apparent reason. Why not, and
more importantly, how can they be deleted? The code is the condensed version
and intentionally uses wildcards (there's additional processing that has been
removed) but it still exposes the problem.
Public Sub Macro6()
On Error GoTo MyErrorHandler
Dim whichDocument As Document
Set whichDocument = ActiveDocument
Dim findrange As Range
Set findrange = whichDocument.Range
findrange.Find.ClearFormatting
findrange.Find.MatchWildcards = True
findrange.Find.Text = "*"
While findrange.Find.Execute() = True
findrange.Delete
DoEvents
Wend
Exit Sub
MyErrorHandler:
MsgBox "Macro6" & vbCrLf & vbCrLf & "Err = " & Err.Number & vbCrLf &
"Description: " & Err.Description
End Sub