Returning FileLen with very large file

S

simonc

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.
 
D

Dave Peterson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top