FILELEN

FILELEN(pathname)

Returns the length of a file in bytes (Long).


pathnameThe full pathname of the file you want to examine (String).

REMARKS
* The "pathname" will often include a directory and a drive.
* If "pathname" is not a valid file path, then you will get a run time error.
* If the file is question is currently open, the value returned is the size of the file immediately before the file was opened.
* You can use the FILEDATETIME function to return the date and time when a file was created or last modified.
* You can use the GETATTR function to return the attributes of a file or directory.
* You can use the LOF function to obtain the length of an open file.
* The equivalent .NET function is [[Microsoft.VisualBasic.FileSystem.FileLen]]
* For the Microsoft documentation refer to learn.microsoft.com

Dim lFileSize As Long 
lFileSize = FileLen("C:\text.txt")
Debug.Print lFileSize

lFileSize = FileLen("C:\temp\myfile.txt")
Debug.Print lFileSize

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top