Create Sequential Access Files : Sequential Access Files « File Path « VBA / Excel / Access / Word






Create Sequential Access Files

 
 
File Access Modes with VBA         
Access Mode            Writing Data      Reading Data         
Sequential/Append      Print#, Write#    Input#, Input         
Random                 Put               Get         
Binary                 Put, Write#       Get, Input#, Input       

Public Sub CreateSeqFile()
    Dim filePath As String
    Dim I As Integer
    filePath = ActiveWorkbook.Path & "\MyHeaders.txt"
    Open filePath For Output As #1
        For I = 1 To 5
            Write #1, Cells(1, I).Value
        Next I
    Close #1
End Sub

 








Related examples in the same category

1.Read Sequential Access Files
2.Write and read Sequential Access Files