R
ryguy7272
I saw the below code from an old post by Douglas Steele a while back:
Declare Function GetDiskFreeSpaceEx Lib "kernel32" _
Alias "GetDiskFreeSpaceExA" _
(ByVal lpcurRootPathName As String, _
lpFreeBytesAvailableToCaller As Currency, _
lpTotalNumberOfBytes As Currency, _
lpTotalNumberOfFreeBytes As Currency) As Long
Sub FreeBytes(NetworkShare As String)
Dim curBytesFreeToCaller As Currency
Dim curTotalBytes As Currency
Dim curTotalFreeBytes As Currency
Call GetDiskFreeSpaceEx(NetworkShare, _
curBytesFreeToCaller, _
curTotalBytes, _
curTotalFreeBytes)
'show the results, multiplying the returned
'value by 10000 to adjust for the 4 decimal
'places that the currency data type returns.
Debug.Print " Total Number Of Bytes:", _
Format$(curTotalBytes * 10000, "###,###,###,##0") & " bytes"
Debug.Print " Total Free Bytes:", _
Format$(curTotalFreeBytes * 10000, "###,###,###,##0") & " bytes"
Debug.Print " Free Bytes Available:", _
Format$(curBytesFreeToCaller * 10000, "###,###,###,##0") & " bytes"
Debug.Print " Total Space Used :", _
Format$((curTotalBytes - curTotalFreeBytes) * 10000,
"###,###,###,##0") & " bytes"
End Sub
I popped it into a Module, and tried to call it through a TextBox, but got
nothing. I tried a ListBox; nothing. How do I call use the code?
Thanks,
Ryan---
Declare Function GetDiskFreeSpaceEx Lib "kernel32" _
Alias "GetDiskFreeSpaceExA" _
(ByVal lpcurRootPathName As String, _
lpFreeBytesAvailableToCaller As Currency, _
lpTotalNumberOfBytes As Currency, _
lpTotalNumberOfFreeBytes As Currency) As Long
Sub FreeBytes(NetworkShare As String)
Dim curBytesFreeToCaller As Currency
Dim curTotalBytes As Currency
Dim curTotalFreeBytes As Currency
Call GetDiskFreeSpaceEx(NetworkShare, _
curBytesFreeToCaller, _
curTotalBytes, _
curTotalFreeBytes)
'show the results, multiplying the returned
'value by 10000 to adjust for the 4 decimal
'places that the currency data type returns.
Debug.Print " Total Number Of Bytes:", _
Format$(curTotalBytes * 10000, "###,###,###,##0") & " bytes"
Debug.Print " Total Free Bytes:", _
Format$(curTotalFreeBytes * 10000, "###,###,###,##0") & " bytes"
Debug.Print " Free Bytes Available:", _
Format$(curBytesFreeToCaller * 10000, "###,###,###,##0") & " bytes"
Debug.Print " Total Space Used :", _
Format$((curTotalBytes - curTotalFreeBytes) * 10000,
"###,###,###,##0") & " bytes"
End Sub
I popped it into a Module, and tried to call it through a TextBox, but got
nothing. I tried a ListBox; nothing. How do I call use the code?
Thanks,
Ryan---