FreeFile Function

Named Arguments

No

Syntax

FreeFile[(rangenumber)]

rangenumber

Use: Optional

Data Type: Variant

Specifies the range of numbers from which the next available file number is selected.

Return Value

An integer representing a the next unused file number.

Description

Returns the next available file number for use in an Open statement.

Rules at a Glance

  • You can change the range of numbers used by FreeFile by supplying a rangenumber argument, as follows:

    rangenumber File Number Range
    0 (or None) 1–255
    1 256–511

Programming Tips and Gotchas

Get into the habit of always using FreeFile to obtain a file number to use in the Open statement: you can't go wrong!

See Also

Open Statement

Get VB & VBA in a Nutshell: The Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.