FreeFile Function

 

FreeFile

 

Returns an integer that is the next available file handle to be used by the Open Statement.

 

Related Topics: Open, Close, Write

 

Example:

 

Sub Main

Dim Mx, FileNumber

For Mx = 1 To 3 

   FileNumber = FreeFile

   Open "c:\e1\TEST" & Mx For Output As #FileNumber  

   Write #FileNumber, "This is a sample."

   Close #FileNumber

Next Mx

 

Open "c:\e1\test1" For Input As #1

Do While Not EOF(1)

   MyStr = Input(10, #1)

   MsgBox MyStr

Loop

Close #1

 

 

End Sub