I know how to open a txt file, and write to it, but how do you open a text file and setp through the characters one by one looking foor a specific character and then replace that character?
Thank for you rhelp.-=Mike Mike Kemp
kempm541145@yahoo.com
open the file in binary mode: pseudocode follows
the data you get may be the ascii value not a string, it's a while since i used binary mode.
' get file length in bytes
' open the file in binary mode
' Dim a as String * 1
' for each character in file
' get #1, a
' If a = Chr(&H22) then ' this is a double quote
' a = "'" ' make it a single quote
' put# a 'etc
' end if
' next
otherwise, access has ODBC support for text files as a database source....
Thank you, Gzep.
I managed to get the job done with:
Sub Mike()
Code:
Dim fs, str_1 as string
set a=fs.opentextfile("c:\myfile.text")
do while a.atendofstream=false
str_1=str_1&vbcrlf&a.readline
loop
open "c:\mynewfile.txt" for outoput as #
print #1, str_1
reset
end sub
YOur is much more character=specific. I am sure I will be able to use it in the future.
Thanks again. Mike Kemp
kempm541145@yahoo.com
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.