Version: 2.5
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.
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 |
objStream.Position = 0
objStream.WriteText strGuruChants
If (objStream.Position < objStream.EOS) Then
objStream.SetEOS = objStream.Position
End If