ADODB Object
 
Syntax
 
streamobject.WriteText Data[, Options]
 
Description
Writes a specified text string to an opened Stream object without adding any intervening spaces or characters.
 
The WriteText method can be used to append or add text data to a Stream object. To add binary data, use the similar Write method.
 
It is wise to use this method very carefully.
 
If there already is text data (characters) in the Stream object and the current position is set to EOS, the new text data will be appended onto the end of the existing data. However, if the current position is not at EOS, then the previously existing data will be overwritten.
 
If you write past the current EOS, the size of the Stream will be implicitly increased, the new EOS will become the last character in the Stream; and the current position will be set at EOS.
 
If you do not write past the current EOS, the current position will be set at the next character after the newly written data. You will also be left with truncated, previously existing data starting at the new current position and continuing out to EOS. You can call the SetEOS method to truncate.
 
There is one mandatory and one optional parameter.
 
Parameter
Description
Data
The Data parameter is a string that contains the text data to write to the Stream.
Options
The Options parameter is one of the StreamWriteEnum constants that determines whether or not a line separator is added to the end of the written text. The LineSeparator property must be set if you wish to add a line separator, or a run-time error will occur.
 
 
StreamWriteEnum Constants 
 
Constant
Value
Description
adWriteChar
0
Default, does not add a line separator
adWriteLine
1
Adds a line separator specified by the LineSeparator property
See Also
Example
 
objStream.Position = 0
objStream.WriteText strChants
If (objStream.Position < objStream.EOS) Then
   objStream.SetEOS = objStream.Position
End If