How to replace without "replace" ?

J

JasonS

Hello!
This is the code I've written for a procedure which opens a CSV file, reads
lines, replaces some characters with others, and then saves it in a new
file.
Everything works OK for Acc 2K, Acc XP and Acc 2003, but it produces an
error on Access 97. It's caused by "replace" method which is a method
available in VBA6, but not in VBA5.
'---------------------------------------------------------------------------
-
Private Sub MakeChangesInFile(FileName As String)

Set oFileSystem = New Scripting.FileSystemObject
Set OpenText = oFileSystem.OpenTextFile(FileName, ForReading, False)
Set SaveText = oFileSystem.OpenTextFile("C:\temp.txt", ForWriting, True)

Do While Not OpenText.AtEndOfLine
Dim liniatemmp As String
liniatemmp = OpenText.ReadLine
liniatemmp = Replace(liniatemmp, Chr(34), "")
SaveText.WriteLine liniatemmp

Loop

OpenText.Close
SaveText.Close

End Sub
'---------------------------------------------------------------------------
--
Can anybody tell me how can I "translate" this procedure into VBA5? How can
I replace something in a file without using "replace"?

Any help would be great!

Thanx, and have a good day
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top