CitectVBA Programming Reference > CitectVBA Function Reference > File I/O Functions > Close

Close

Closes the file(s) previously opened with the Open statement.

The optional FileNumList parameter can contain one or more valid file associated reference numbers using the following syntax:

[[#]FileNum] [, [#]FileNum] ...

where Filenum is any valid number associated with an open file.

If the Close statement is used without any arguments it closes all open files. When the Close statement is executed, the association of a file with its file number ends.

Syntax

CloseFileNumList

FileNumList:

Must contain one or more valid integer or numeric expression values representing associated file numbers using the following syntax:
[[#]filenumber] [, [#]filenumber] ... where filenumber is any valid number associated with an open file.

Related Functions

FileCopy | FreeFile | Kill | Name | Open

Example

Dim strFileContents As String
Dim strTemp As String
Open "c:\test.txt" For Input As #1 ' open file.
Do While Not EOF(1) ' loop until end of file
strTemp = Input(10, #1) ' read next ten characters
strFileContents = strFileContents & strTemp ' join strings
Loop
Close #1