FREEFILE[(rangenumber)]

Returns the next valid free file number (Integer).


rangenumber(Optional) The number which is the next free file (Variant):
0 = range 1 - 255
1 = range 256 - 511

REMARKS
* The "rangenumber" specifies the range from which the next free file number is to be returned.
* If "rangenumber" is left blank, then 0 is used.
* This function should be used when you use the OPEN statement.
* This function should be used to supply a file number that is not already in use.
* If you have been letting the system supply the file number, checking this value will reveal how many files have been opened this session.
* The equivalent .NET function is Microsoft.VisualBasic.FileSystem.FreeFile
* For the Microsoft documentation refer to docs.microsoft.com

Dim ifileno As Integer 
ifileno = 8
Open "C:\temp\myfile.txt" For Output As #ifileno

© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited Top