S
Stephen Lynch
I am looking to open a text file, input each line and rewite the line adding
a file name plus 1. For example:
Original text file
John, Doe, Chicago
Jane, Doe, Chicago
What I want
John, Doe, Chicago, 1
Jane, Doe, Chicago, 2
Also, I am refering to a file name that I have declared in another function
as a string so I am not sure if I need to change that. But here's where I
am, just learning.
Function Add1toEndofFile(FileID As String)
Dim strOneLine As String
Dim strCounter As Integer
FileID = FreeFile
Open FileID For Input As #FileID
Do Until EOF(FileID)
Line Input #FileID, strOneLine
Print strOneLine, FileID &" "& strCounter
strCounter = strCounter + 1
Loop
Close #FileID
But I am getting all kinds of errors. What I want to do is open the same
file and just add the filename and counter line to the end of each line.
Thanks for any assistance.
End Function
a file name plus 1. For example:
Original text file
John, Doe, Chicago
Jane, Doe, Chicago
What I want
John, Doe, Chicago, 1
Jane, Doe, Chicago, 2
Also, I am refering to a file name that I have declared in another function
as a string so I am not sure if I need to change that. But here's where I
am, just learning.
Function Add1toEndofFile(FileID As String)
Dim strOneLine As String
Dim strCounter As Integer
FileID = FreeFile
Open FileID For Input As #FileID
Do Until EOF(FileID)
Line Input #FileID, strOneLine
Print strOneLine, FileID &" "& strCounter
strCounter = strCounter + 1
Loop
Close #FileID
But I am getting all kinds of errors. What I want to do is open the same
file and just add the filename and counter line to the end of each line.
Thanks for any assistance.
End Function