Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can u edit a textfile as it is being written to

Status
Not open for further replies.

JasonV

MIS
Jun 9, 1999
10
0
0
US
I am opening an Access Database and using recordsets, I am adding html tags to the data so as to be able to create an HTML table page. After I write the strings to the textfile, I'd like to be able to replace the (")quote marks with nothing. For example, this is what is going on.<br>
<br>
Open "N:\directory\testfile.txt" for output as # 1<br>
<br>
Write #1, "&lt;html&gt;"<br>
Write #1, "&lt;body&gt;"<br>
<br>
'start table in HTML<br>
Write #1, "&lt;table border=1&gt;"<br>
<br>
'print the header to testfile and read ColumnLabel Count<br>
Write #1, "&lt;th colspan =" & rstColumnLabels.RecordCount & "&gt;" & "&lt;font size=20&gt;" & "&lt;center&gt;" & rstHeading.Fields("Heading") & "&lt;/center&gt;" & "&lt;/font&gt;" & "&lt;/th&gt;"<br>
<br>
Close #1<br>
<br>
ANy suggestions? (p.s. I'm using VB6)<br>

 
Not sure how to do anything like this WHILE the file is being saved, but isn't there some command in VB6 that allows you to scan a file for occurrences of a certain character, or string of characters? (if so, then you could run through the file with that command (using it do find & delete occurrences of ") on the file right after it has been saved.<br>
<br>
<br>
-Robherc<br>
robherc@netzero.net
 
Using the above code, you should not have any "'s in the file you are writing to. You are simply passing a string literal to the Write function so that Write #1, "This string" should look like:<br>
This String <br>
<br>
and not:<br>
"This String"<br>
<br>

 
Thanks for the help. I figured out that I should of been using the PRINT tag instead Of WRITE. <br>
<br>
Jason
 
Are VB6 scripts really THAT plainly spelled out???<br>
(ie. Open "N:\directory\testfile.txt" for output as # 1)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top