CLOSE [#][filenumber][,][#]filenumber]

Closes a text file.


filenumber(Optional) The number of the file (Integer).

REMARKS
* The "filenumber" can be one or more file numbers (eg #12, #13, #14)
* If "filenumber" is left blank, then all files opened using the Open statement are closed.
* Closes all open files or the file specified by the "filenumber".
* You can use the OPEN statement to open a text file or csv file.
* You can use the PRINT statement to write display formatted data to a sequential file.
* You can use the WRITE statement to write data to a sequential file.
* This function is not available in Access.
* For the Microsoft documentation refer to learn.microsoft.com

Dim iCount As Integer 
Dim sFileName As String

For iCount = 1 To 3
    sFileName = "C:\Temp\MyText" & iCount & ".txt"
    Open sFileName For Output As #iCount
    Print #iCount, "This is a test"
Next iCount

Close 2
Close (2)
Close

© 2023 Better Solutions Limited. All Rights Reserved. © 2023 Better Solutions Limited Top