Reading and Writing to Files on the Intranet - Writing to a file with an HTM extension (Page 4 of 5 )
The listing in the next paragraph writes to the Test.htm file on the intranet site in the folder.
Set rec = New ADODB.Record
rec.Open "DevHome/ASPFree/Test.htm", _
"URL=http://hodentek/", adModeReadWrite, _
adCreateOverwrite + adCreateNonCollection
Set strm = New ADODB.stream
strm.Type = adTypeText
strm.Charset = "ASCII"
strm.Open rec, adModeReadWrite, adOpenStreamFromRecord
strm.WriteText "<html><head><title>QuoteFromPrince</title></head><body>",
adWriteLine
strm.WriteText "<center><p><font color='red'>Quote from Prince Niccolo
Machiavelli</font></p>
</center> "
strm.WriteText "<blockquote><font color='blue'>It must be remembered that
there is nothing more
difficult of success, nor more dangerous to plan than the", adWriteLine
strm.WriteText "creation of a new System --<b>The Prince</b></font>
</blockquote>", adWriteLine
strm.WriteText "</body></html>"
strm.Flush
strm.Close
rec.Close
End Sub
The Test.htm file when browsed shows the following display.

Next: Reading and writing binary files >>
More Database Articles
More By Jayaram Krishnaswamy