'add a richtextbox control (visible= false) to a form, and try this code.
'Your matter is : you have a lot of chr$(6) in your text. Look at after file
'with your application. Hope this may solve.

private Sub Command1_Click()

With RichTextBox1
.FileName = "C:\before.txt"
'use "<" and ">" as they are readed this way
.Text = Replace(.Text, "<PhoneNumber>", "02020202", , , vbBinaryCompare)
.SaveFile "c:\after.txt", rtfText
'debug:
'.FileName = "c:\after.txt"
End With
End Sub





Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.