FreeFile Function

Purpose

Returns the next free file number.

Syntax

n = FreeFile

n:iexp

Description

Returns the next free file number to be used with the Open statement. The return value is an integer in the range 0 .. 511.

Example

Debug.Show

Trace FreeFile

Remarks

If working with more complex programs, it is recommend to use a variable, rather than a fixed number.

Local Dat% = FreeFile

Open App.Path & "\test.dat" for Output As # Dat%

Close # Dat%

Kill App.Path & "\test.dat" // Tidy-up line

See Also

Open

{Created by Sjouke Hamstra; Last updated: 07/10/2014 by James Gaite}