Only if the file size does not exceed 2 gigabytes. Otherwise, it can (and will) return a negative number. In VB6, the only way I know to get the true file size, especially for files of > 4 gigabytes is:
Public Function DblGetFileSize(fname As String) As Double On Error Resume Next Dim fs, f, s
Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.GetFile(fname) DblGetFileSize = f.size Set f = Nothing Set fs = Nothing End Function
It will return a double type that will be the true size of the file.
Only if the file size does not exceed 2 gigabytes. Otherwise, it can (and will) return a negative number. In VB6, the only way I know to get the true file size, especially for files of > 4 gigabytes is:
ReplyDeletePublic Function DblGetFileSize(fname As String) As Double
On Error Resume Next
Dim fs, f, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(fname)
DblGetFileSize = f.size
Set f = Nothing
Set fs = Nothing
End Function
It will return a double type that will be the true size of the file.