How to read certain line in a txt file, for example to read line 3 or reading from line 3 to 10 ?
check this link: Read specific line from text file
CS
or: VB Code: Dim sLines() As String, N As Long Open "C:\test.txt" For Input As #1 sLines = Split(Input(LOF(1), #1), vbCrLf) Close #1 ' Line 3 (it's 0-based) Debug.Print sLines(2) ' Lines 3 to 10 For N = 2 To 9 Debug.Print sLines(N) Next N
Dim sLines() As String, N As Long Open "C:\test.txt" For Input As #1 sLines = Split(Input(LOF(1), #1), vbCrLf) Close #1 ' Line 3 (it's 0-based) Debug.Print sLines(2) ' Lines 3 to 10 For N = 2 To 9 Debug.Print sLines(N) Next N
Take a moment to rate useful posts VB6 CodeBank: Glass Form & Tracing App , MouseWheel with Any Control , Form Previewer Utility VB6 Snippets: RTB: Disable Smooth Scrolling , Form: Left & Right Justified Text in TitleBar , ListBox: As-You-Type Filtering (fast) , MSFlexGrid: Non-Adjacent Col/Row Selection , IsProcessRunning: PSAPI / WMI , PictureBox: Frame Look-A-Like , Open Folder in a Particular View , Form: Always on Bottom VBA Snippet: Generic Mouseover Workaround
Forum Rules