HomePrivacy PolicyFeedbackLink to usSite Map

MS Excel: FileLen Function (VBA only)


In Excel, the FileLen function returns the size of a file in bytes.

The syntax for the FileLen function is:

FileLen( file_path )

file_path is the path to a file name that you wish to retrieve the size for.


Applies To:

  • Excel 2007, Excel 2003, Excel XP, Excel 2000

For example:

FileLen("C:\instructions.doc") would return 55808
FileLen("H:\Documents\Supplies.xls") would return 1254

VBA Code

The FileLen function can only be used in VBA code. For example:

Dim LResult As Long

LResult = FileLen("C:\instructions.doc")

In this example, the variable called LResult would now contain the size of the instructions.doc file in bytes.