Examples of the VBA Open Statement : FreeFile « File Path « VBA / Excel / Access / Word






Examples of the VBA Open Statement

 
Sub SimpleOpenExamples() 
    Dim lInputFile As Long 
    Dim lOutputFile As Long 
    Dim lAppendFile As Long 

    lInputFile = FreeFile 
    Open "C:\MyInputFile.txt" For Input As #lInputFile 
    lOutputFile = FreeFile 
    Open "C:\MyNewOutputFile.txt" For Output As #lOutputFile 
    lAppendFile = FreeFile 
    Open "C:\MyAppendFile.txt" For Append As #lAppendFile 
    Close lInputFile, lOutputFile, lAppendFile 
End Sub 

 








Related examples in the same category

1.An Example Using Write # and Input #
2.Text Files and File Dialog
3.Writing to Text Files Using Print
4.Reading Data Strings
5.Flexible Separators and Delimiters
6.uses the delimiter characters to decide the data type of each item and treat it appropriately:
7.Handling Files with Low-Level File Handling