FileLen Function

Returns the length of a file in bytes.

Syntax:


FileLen (Text As String) As Long

Return value:

Long

tip

Use ScriptForge.FileSystem service GetFileLen() method when size is expected to be over 2 gigabytes.


Parameters:

Text: Any string expression that contains an unambiguous file specification. You can also use URL notation.

This function determines the length of a file. If the FileLen function is called for an open file, it returns the file length before it was opened. To determine the current file length of an open file, use the Lof function.

Error codes:

5 Invalid procedure call

Example:


Sub ExampleFileLen
    MsgBox FileLen("C:\autoexec.bat")
End Sub

Please support us!