Microsoft® Visual Basic® Scripting Edition WriteLine Method | Language Reference Version 2

See Also Applies to

##### Description

> Writes a specified string and newline character to a TextStream file.

##### Syntax

> object.WriteLine([string])

> The WriteLine method syntax has these parts:

> Part | Description
> object | Required. Always the name of a TextStream object.
> string | Optional. The text you want to write to the file. If omitted, a newline character is written to the file.

##### Remarks

> The following example illustrates use of the WriteLine method:

> >     Function WriteLineToFile
> >       Const ForReading = 1, ForWriting = 2
> >       Dim fso, f
> >       Set fso = CreateObject("Scripting.FileSystemObject")
> >       Set f = fso.OpenTextFile("c:\testfile.txt", ForWriting, True)
> >       f.WriteLine "Hello world!"
> >       f.WriteLine "VBScript is fun!"
> >       Set f = fso.OpenTextFile("c:\testfile.txt", ForReading)
> >       WriteLineToFile = f.ReadAll
> >     End Function

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.