hey guys,
Assume a complete novice here (well kind of) who is looking for an efficient way to process .txt files. Actually a few days ago I decided to port all my reports that query to external databases to access and work from there.
Currently stuck with quite a simples problem on importing and processing some data that I will later use.
In essence I need to open a file in VBA, read every single line, remove blanks lines and some other ones that match some string and then save it as a processed file (also .txt)
Given that I have limited experience in vba I have so far arrived at the following, after some googling:
And here I am stuck. Basically I do not even know how to visualise the lines that were imported. Other than that how could I
- loop through every line
- check if a line matches a certain string
- export to file
Any help would come in handy.
Thanks
Assume a complete novice here (well kind of) who is looking for an efficient way to process .txt files. Actually a few days ago I decided to port all my reports that query to external databases to access and work from there.
Currently stuck with quite a simples problem on importing and processing some data that I will later use.
In essence I need to open a file in VBA, read every single line, remove blanks lines and some other ones that match some string and then save it as a processed file (also .txt)
Given that I have limited experience in vba I have so far arrived at the following, after some googling:
Sub ProcessReportFiles()
Dim inFile As Integer
Dim outFile As Integer
inFile = FreeFile
Open "C:\test.txt" For Input As inFile
lngChars = LOF(inFile)
strImport = Input(lngChars, inFile)
.....................
End Sub
And here I am stuck. Basically I do not even know how to visualise the lines that were imported. Other than that how could I
- loop through every line
- check if a line matches a certain string
- export to file
Any help would come in handy.
Thanks