Filesize



Public Function FormatFileSize(ByVal dblFileSize As Double) As String
Select Case dblFileSize
Case 0 To 999' Bytes
FormatFileSize = Format(dblFileSize) & " bytes"
Case 1000 To 1023999' KB
FormatFileSize = Format(dblFileSize / 1024, "##0.0") & " KB"
Case 1024000 To (1024 * 10 ^ 6) - 1 ' MB
FormatFileSize = Format(dblFileSize / (1024 ^ 2), "##0.0#") & " MB"
Case Is > (1024 * 10 ^ 6)
FormatFileSize = Format(dblFileSize / (1024 ^ 3), "##0.0#") & " GB"
End Select
End Function

(filesize.html)- by Paolo Puglisi - Modifica del 25/3/2019