Table of contents
Collapse the table of content
Expand the table of content

FileLen Function

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

Returns a Long specifying the length of a file in bytes. SyntaxFileLen(pathname) The required pathnameargument is astring expression that specifies a file. The pathname may include the directory or folder, and the drive. Remarks If the specified file is open when the FileLen function is called, the value returned represents the size of the file immediately before it was opened.

Note To obtain the length of an open file, use the LOF function.


This example uses the FileLen function to return the length of a file in bytes. For purposes of this example, assume that TESTFILE is a file containing some data.

Dim MySize
MySize = FileLen("TESTFILE")    ' Returns file length (bytes).

© 2018 Microsoft