Close (statement)

Syntax

Close [[#] filenumber [,[#] filenumber]...]

Description

Closes the specified files.

Comments

If no arguments are specified, then all files are closed.

Example

This example opens four files and closes them in various combinations.

Sub Main()

  Open "test1" For Output As #1
  Open "test2" For Output As #2
  Open "test3" For Random As #3
  Open "test4" For Binary As #4
  MsgBox "The next available file number is: " & FreeFile()
  Close #1         'Closes file 1 only.
  Close #2,#3      'Closes files 2 and 3.
  Close            'Closes all remaining files(4).
  MsgBox "The next available file number is: " & FreeFile()
End Sub

See Also

Open (statement); Reset (statement); End (statement).

More information

C