J
Joanne
I wrote the following code to get rid of extraneous characters at the end of
a document. Once I get the "Move Start" working correctly, I want to delete
any character at the end of the document that is not an actual A-z character.
I am testing the macro on the numbers "1234". The macro works fine with the
"4" and the "3". The value of rng becomes first "4" and then "34" but the
"Like" comparison doesn't seem to see the "2" as a non alphabetic character
because as soon as it passes the "Like" line, it jumps out of the while loop.
I can't see what I'm doing wrong. Thanks so much for your help.
Joanne
Sub FixEndSemis()
Dim rng As Range
Set rng = ActiveDocument.Range
With rng
.Collapse wdCollapseEnd
.MoveStart Unit:=wdCharacter, Count:=-1
While .Text Like "[!A-Za-z]"
.MoveStart Unit:=wdCharacter, Count:=-1
'.Select
Wend
End With
a document. Once I get the "Move Start" working correctly, I want to delete
any character at the end of the document that is not an actual A-z character.
I am testing the macro on the numbers "1234". The macro works fine with the
"4" and the "3". The value of rng becomes first "4" and then "34" but the
"Like" comparison doesn't seem to see the "2" as a non alphabetic character
because as soon as it passes the "Like" line, it jumps out of the while loop.
I can't see what I'm doing wrong. Thanks so much for your help.
Joanne
Sub FixEndSemis()
Dim rng As Range
Set rng = ActiveDocument.Range
With rng
.Collapse wdCollapseEnd
.MoveStart Unit:=wdCharacter, Count:=-1
While .Text Like "[!A-Za-z]"
.MoveStart Unit:=wdCharacter, Count:=-1
'.Select
Wend
End With