Mega Code Archive

 
Categories / VisualBasic Script / File Path
 

Use a Do While loop to keep reading records until youve reached the end of the file

Sub ImportAll()     ThisFile = "C:\sales.txt"     Open ThisFile For Input As #1     Ctr = 0     Do         Line Input #1, Data         Ctr = Ctr + 1         Cells(Ctr, 1).Value = Data     Loop While EOF(1) = False     Close #1 End Sub