CitectVBA Programming Reference > CitectVBA Function Reference > File I/O Functions > FileLen

FileLen

FileLen function determines the byte length of a file. The required File argument must be valid string expression representing a valid file name. File may contain a DOS path structure including directory or folder names, and a drive letter.

The FileLen function returns the size of a file immediately before it was most recently opened. To obtain the length of a file that is already open, use the LOF function.

Syntax

FileLen(File)

File:

A string or expression that can represent a valid file name, and may include a DOS path structure including directory or folder names, and a drive letter.

Return Value

Returns a Long value representing the length of the file measured in bytes.

Related Functions

EOF | Loc | LOF | Seek

Example

Dim lonFileSize As Long
lonFileSize = FileLen("C:\TESTFILE.txt") ' returns length of file in bytes