The NumberOfBytesFree Function : Drive « File Path « VBA / Excel / Access / Word






The NumberOfBytesFree Function

 
Function NumberOfBytesFree(ByVal strDrive As String) As String
   Dim lngSectors As Long
   Dim lngBytes As Long
   Dim lngFreeClusters As Long
   Dim lngTotalClusters As Long
   Dim intErrNum As Integer

   intErrNum = abGetDiskFreeSpace(strDrive, lngSectors, _
   lngBytes, lngFreeClusters, lngTotalClusters)
   NumberOfBytesFree = " with " & _
         Format((CDbl(lngBytes) * CDbl(lngSectors)) * _
         CDbl(lngFreeClusters), "#,##0") & _
         " Bytes Free"
End Function

 








Related examples in the same category

1.Get Drive Information
2.The TypeOfDrive Function
3.Returns the number of free bytes for a drive
4.Returns the total storage capacity for a drive
5.Returns a string that describes the drive type
6.Returns True if a specified drive letter exists
7.Returns the number of drives
8.Returns the drive letter using an index
9.Display Drive information