Martin
Fri Jan 16 02:06:10 CST 2004
Hi there
> Replace doesn't work for Word 97 :( Do you know an similar thing. Rest
> of code works fine.
Here's code which simulates the replace functionality:
Function MyReplace(ByVal txt As String, fnd As String, rpl As String) As
String
Dim pos As Integer
' replace first occurence of text fnd until no occurence found
Do
pos = InStr(1, txt, fnd)
If pos = 0 Then Exit Do
txt = Left(txt, pos - 1) + rpl + Mid(txt, pos + Len(fnd))
Loop
MyReplace = txt
End Function
Note, that I used another name to prevent confusion with the built-in
Replace-function of later versions of Office-VBA. The usage, however,
is the same:
... MyReplace( myTextHere, vbCrLf, vbCr) & " "
Cheers,
Martin
"beata" <beata.1041qv@nospam.WordForums.com> schrieb im Newsbeitrag
news:beata.1041qv@nospam.WordForums.com...
>
> Replace doesn't work for Word 97 :( Do you know an similar thing. Rest
> of code works fine.
>
> ciao
>
>
> ------------------------------------------------
> ~~ Message posted from
http://www.ExcelTip.com/
> ~~View and post usenet messages directly from
http://www.ExcelForum.com/
>