Monday, October 30, 2017

To get the size of specified file

Function fnGet_FileSize(str_Path_FileName)
   On Error Resume Next
'Specify the Path along with the file name
On Error Resume Next
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(str_Path_FileName) Then
Set ofile = fso.GetFile(str_Path_FileName)
File_Size = ofile.Size & " bytes"
Else
Call DoneResult("Specified File: " & str_Path_FileName & " not found", "Not able to fetch size of the file")
End If
fnGet_FileSize = File_Size
Set fso = Nothing
Set ofile = Nothing
End Function

No comments:

Post a Comment