I have opened a text file for input. But before I can process my loop, I have already reached the EOF. Why is this and how do I set it back to the beginning? Below is the code I am using:

Function FileToCSV(sFile as string, sCsv as string)
Dim buffer as string

Open sFile for input as #1
Open sCsv for Output as #2

Do While Not EOF(1)
Line input #1, buffer
print #2, buffer & ","
Loop

Close #1
Close #2

End Function



As you can tell, I'm trying to convert a textfile into a CSV file.
I've searched for some examples and can't find any. I would love any suggestions either for the EOF fix or example code for converting a text file into a CSV file.
Thanks,
Greg