Search for and Replace strings in a text file 
Author Message
 Search for and Replace strings in a text file

Hi all...
Here's my roadblock de jour.

I'm automating an application to repair/compact, then zip up, then ftp the
back end tables for replication purposes.  Here's the glitch...

I have a script file (update.scr) that I use in the ftp process.  It logs me
onto the ftp server, changes the local directory to the folder containing my
zip file, and sends it to the ftp server.  Problem is the local directory
may vary from computer to computer..  so I decided I would just get the
correct path, then edit the script file with vba.  This is turning out to be
more difficult than I thought!

Could anyone give an example of code to open the file, read it one line at a
time (it has line breaks of course) and if that line meets a criteria,
replace it with a new one and save the file?

Thanks in advance!



Sat, 27 Apr 2002 03:00:00 GMT  
 Search for and Replace strings in a text file
David,

Check Open, Line Input and Instr() in the Help Files.  That should get you
started at least.

HTH,
Marsh

Quote:

>Hi all...
>Here's my roadblock de jour.

>I'm automating an application to repair/compact, then zip up, then ftp the
>back end tables for replication purposes.  Here's the glitch...

>I have a script file (update.scr) that I use in the ftp process.  It logs
me
>onto the ftp server, changes the local directory to the folder containing
my
>zip file, and sends it to the ftp server.  Problem is the local directory
>may vary from computer to computer..  so I decided I would just get the
>correct path, then edit the script file with vba.  This is turning out to
be
>more difficult than I thought!

>Could anyone give an example of code to open the file, read it one line at
a
>time (it has line breaks of course) and if that line meets a criteria,
>replace it with a new one and save the file?

>Thanks in advance!

  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


Sat, 27 Apr 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Searching And Replacing Strings Within A Text File

2. Searching And Replacing Strings Within A Text File

3. How to search a text file and replace text

4. How to search and replace text in text file

5. How to search and replace text in text file

6. How to search and replace text in text file

7. Search and Replace string in a text box

8. How to replace text string in text file

9. Search for a text string in text file

10. search & replace text with a file

11. Working with Text Files - Searching for strings and then exporting to new file

12. Replace string value in a text file

 

 
Powered by phpBB® Forum Software