Toto patří ještě k tomu
Private Function ResizeKb(ByVal b As Double) As String
Dim bSize(8) As String, i As Integer
bSize(0) = "Bytes"
bSize(1) = "kB" 'Kilobytes
bSize(2) = "MB" 'Megabytes
bSize(3) = "GB" 'Gigabytes
bSize(4) = "TB" 'Terabytes
bSize(5) = "PB" 'Petabytes
bSize(6) = "EB" 'Exabytes
bSize(7) = "ZB" 'Zettabytes
bSize(8) = "YB" 'Yottabytes
For i = bSize.Length - 1 To 0 Step -1
If b >= (1024 ^ i) Then
Return ThreeNonZeroDigits(b / (1024 ^ i)) & " " & bSize(i)
End If
Next
Return "0 kB"
End Function
Private Function ThreeNonZeroDigits(ByVal value As Double) As Double
If value >= 100 Then
Return FormatNumber(value)
ElseIf value >= 10 Then
Return FormatNumber(value, 1)
Else
Return FormatNumber(value, 2)
End If
End Function
|