Method: SkipLine for TextStream
- Updated2024-09-12
- 1 minute(s) read
FileSystemObject and Dictionary > Methods > Method: SkipLine for TextStream
Method: SkipLine for TextStream
Skips a line when reading a TextStream file.
Object.SkipLine
Object | TextStream Object with this method |
The following example opens a text file into which it writes two text lines. Then the example opens the file for reading, skips the first line, and returns the second line:
Function SkipOneLine(sFile) Const ForReading = 1, ForWriting = 2 Dim fso, oMyFile Set fso = CreateObject("Scripting.FileSystemObject") Set oMyFile= fso.OpenTextFile(sFile, ForWriting, True) oMyFile.Write "First Line" & vbCrLf & "Second Line" Set oMyFile = fso.OpenTextFile(sFile, ForReading) oMyFile.SkipLine SkipOneLine = oMyFile.ReadLine End Function