Código
Option Explicit Private Declare Function SHGetDiskFreeSpace Lib "shell32" Alias "SHGetDiskFreeSpaceA" (ByVal pszVolume As String, pqwFreeCaller As Currency, pqwTot As Currency, pqwFree As Currency) As Long Private Declare Function StrFormatByteSize64A Lib "SHLWAPI.DLL" (ByVal qdw As Currency, ByVal pszBuf As String, ByVal uiBufSize As Long) As Long Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long Private Sub Form_Load() Dim cFreeCaller As Currency Dim cTotal As Currency Dim cFreeTotal As Currency Dim cFormat As Currency Dim sBuff As String If Not SHGetDiskFreeSpace( _ Environ$("HOMEDRIVE"), _ cFreeCaller, _ cTotal, _ cFreeTotal) = 0 Then Debug.Print "Drive: " & Environ$("HOMEDRIVE") cFormat = cFreeTotal: GoSub Format: Debug.Print "Total Free Space: " & sBuff cFormat = cFreeCaller: GoSub Format: Debug.Print "Free Caller: " & sBuff cFormat = cTotal: GoSub Format: Debug.Print "Total Space: " & sBuff End If Exit Sub Format: sBuff = Space(32) StrFormatByteSize64A cFormat, sBuff, 32 sBuff = Left(sBuff, lstrlen(sBuff)) Return End Sub