Private Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, lpTtoalNumberOfClusters As Long) As Long
Sub FreeDiskSpace()
Dim SectorsPerCluster As Long
Dim BytesPerSector As Long
Dim NumberofFreeClusters As Long
Dim TotalClusters As Long
x = GetDiskFreeSpace("c:\", SectorsPerCluster, _
BytesPerSector, NumberofFreeClusters, TotalClusters)
If x = 0 Then 'Error occurred
Exit Sub
End If
Debug.Print SectorsPerCluster
Debug.Print BytesPerSector
Debug.Print NumberofFreeClusters
End Sub
|