FreeFile Function

Syntax
FreeFile[( )]
Group
File
Description
Return the next unused shared stream number (greater than or equal to 256). Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros.
Sandbox
Sandbox mode blocks this function.

Sub Main
    Debug.Print FreeFile ' 256
    FN = FreeFile
    Open "XXX" For Output As #FN
    Debug.Print FreeFile ' 257
    Close #FN
    Debug.Print FreeFile ' 256
End Sub