Write and read Sequential Access Files
Public Sub CreateSeqFile()
Dim filePath As String
Dim I As Integer
filePath = ActiveWorkbook.Path & "\SeqPhone.txt"
Open filePath For Output As #1
For I = 1 To 3
Write #1, Cells(I, "A").value, Cells(I, "B").value
Next I
Close #1
End Sub
Public Sub ReadSeqFile()
Dim filePath As String
Dim I As Integer
Dim theName As String
Dim theNumber As String
I = 1
filePath = ActiveWorkbook.Path & "\SeqPhone.txt"
Open filePath For Input As #1
Do While Not EOF(1)
Input #1, theName, theNumber
Cells(I, "A").value = theName
Cells(I, "B").value = theNumber
I = I + 1
Loop
Close #1
End Sub
Related examples in the same category