Returns a Long representing the size, in bytes, of a file opened using the FileOpen function.
Public Function LOF(ByVal FileNumber As Integer) As Long
Exception type | Error number | Condition |
---|---|---|
52 | FileNumber does not exist. | |
54 | File mode is invalid. |
Use the FileLen function to obtain the length of a file that is not open.
This example uses the LOF function to determine the size of an open file. This example assumes that TESTFILE
is a text file containing sample data.
Dim length As Integer FileOpen(1, "C:\TESTFILE.TXT", OpenMode.Input) ' Open file. length = LOF(1) ' Get length of file. Debug.WriteLine(length) FileClose(1) ' Close file.
EOF Function | FileLen Function | Loc Function | FileOpen Function |