Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

properties disk space

Status
Not open for further replies.

matrixindicator

IS-IT--Management
Sep 6, 2007
418
BE
Is it possible to get some properties of disk space of your local drive along VBA ?

1. how to get the number of total diskspace.
2. how to get the used diskspace.
3. how to get the available diskspace.




 
You can use the FileSystemObject:

Code:
Sub DiskDetails()
'The reference for the FileSystemObject Object is Windows Script Host Object Model
'but it not necessary to add the reference for this procedure.

Dim fs As Object
Dim d As Object

Set fs = CreateObject("Scripting.FileSystemObject")
Set d = fs.GetDrive("C")

'Use FormatNumber(d.<property> / 1024, 0) for KB
Debug.Print d.AvailableSpace
Debug.Print d.FreeSpace
Debug.Print d.TotalSize

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top