cosmoh2o,
I just reread some of the thread and I'm not sure whether you actually want the last character of the document or not. Suggest you do what you want in Word and record a macro while you do it.
Tools > Macro > Record New Macro, just press Enter to take the defaults
Now do what you want, which is something like
<Ctrl><End> (to go to the end of the document)
<Ctrl><H> (to bring up the Replace Window)
Enter Find and Replace texts
If "More" is shown on a button, press it, if "Less" is shown, you're OK.
Select "Up" in the Search combobox
Press "Find Next" to get to the last occurrence
Press "Replace" to replace it.
Press "Close" to close the window
Now stop recording - press the saquare on the Stop Recording Toolbar or do Tools > Macros > Stop Recording
Now go and look at the code. I just did it and got the following:
Code:
Sub Macro7()
'
' Macro7 Macro
' Macro recorded 11/04/03 by Tony Jollans
'
Selection.EndKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "b"
.Replacement.Text = "zz"
.Forward = False
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
With Selection
If .Find.Forward = True Then
.Collapse Direction:=wdCollapseStart
Else
.Collapse Direction:=wdCollapseEnd
End If
.Find.Execute Replace:=wdReplaceOne
If .Find.Forward = True Then
.Collapse Direction:=wdCollapseEnd
Else
.Collapse Direction:=wdCollapseStart
End If
.Find.Execute
End With
End Sub
I used my own characters which I had in my text - you will need to replace them with yours. I did notice that ^M was not considered valid by my Word 2000, so I'm not exactly sure what you'll to do with that.
Enjoy,
Tony