ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Returning FileLen with very large file (https://www.excelbanter.com/excel-programming/413227-returning-filelen-very-large-file.html)

simonc

Returning FileLen with very large file
 
FileLen returns a Long integer but I have a file which is over 7GB in size,
which is beyond the limit of a long integer so I get an overflow error. I
need to extract the file length to calculate details of the contents of the
file. How can I do this?

Grateful for assistance.

Dave Peterson

Returning FileLen with very large file
 
Option Explicit
Sub testme()
Dim myFileName As String
Dim FSO As Object

Set FSO = CreateObject("Scripting.FileSystemObject")
myFileName = "C:\My Documents\giganticfilename.here")

MsgBox Format(FSO.GetFile(myFileName).Size, "#,##0")

End Sub

simonc wrote:

FileLen returns a Long integer but I have a file which is over 7GB in size,
which is beyond the limit of a long integer so I get an overflow error. I
need to extract the file length to calculate details of the contents of the
file. How can I do this?

Grateful for assistance.


--

Dave Peterson


All times are GMT +1. The time now is 12:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com