I need to read an import text file via VB or VBA only select lines that start with a number and write those lines to a new file
I have looked at Streamreader/streamwriter but cannot understand the way to select the line
open a text file and only use lines that start with a number, then wriopen a text file and only use lines that start with a number, then wri
Page 1 of 1
2 Replies - 1739 Views - Last Post: 21 September 2010 - 11:04 AM
#1
open a text file and only use lines that start with a number, then wri
Posted 21 September 2010 - 04:11 AM
Replies To: open a text file and only use lines that start with a number, then wri
#2
Re: open a text file and only use lines that start with a number, then wri
Posted 21 September 2010 - 04:27 AM
streamreader/writer is VB.NET. but there is a tutorial about reading text file line by line in our tutorial section under vb6 section
#3
Re: open a text file and only use lines that start with a number, then wri
Posted 21 September 2010 - 11:04 AM
This is not the complete code and also not tested. It reads a line and stores it in variable tLine. You would then need to apply your logic around if you wanna use that line or not. Also, How do you wanna use it.
Hope it helps!!!!
Dim FileNum As Integer, tLine As String, LogFileName as String
LogFileName = "Complete path to your Text File"
FileNum = FreeFile ' next file number
Open LogFileName For Input Access Read Shared As #FileNum ' open the file for reading
Do While Not EOF(FileNum)
Line Input #FileNum, tLine ' read a line from the text file
Loop ' until the last line is read
Close #FileNum ' close the file
Hope it helps!!!!
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|