use API:
《HOWTO: Use the GetDiskFreeSpaceEx() API to Obtain Disk Free Space Amounts》
http://support.microsoft.com/support/kb/articles/q202/4/55.asp
《HOWTO: Find and View the Amount of Free Disk Space on a Drive》
http://support.microsoft.com/support/kb/articles/Q153/0/91.ASP
'引用 Microsoft Scripting Runtime
Dim x As New Scripting.FileSystemObject
Dim y As Scripting.Drive
For Each y In x.Drives
Debug.Print y.DriveType
If y.DriveType = Fixed Then
Debug.Print y.TotalSize
Debug.Print y.FreeSpace
End If
Next
'引用 Microsoft Scripting Runtime
Dim x As New Scripting.FileSystemObject
Dim y As Scripting.Drive
For Each y In x.Drives
Debug.Print y.DriveType
If y.DriveType = Fixed Then
y.FreeSpace
End If
Next
Sub ShowFreeSpace(drvPath)
Dim fs, d, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set d = fs.GetDrive(fs.GetDriveName(drvPath))
s = "Drive " & UCase(drvPath) & " - "
s = s & d.VolumeName & vbCrLf
s = s & "Free Space: " & FormatNumber(d.FreeSpace / 1024, 0)
s = s & " Kbytes"
MsgBox s
End Sub