Display Drive information : Drive « File Path « VBA / Excel / Access / Word






Display Drive information

 
Sub cmdDriveInfo_Click()
    Dim myFileSystemObject As FileSystemObject, aDrive As Drive

    Set myFileSystemObject = New FileSystemObject
    Set aDrive = myFileSystemObject.GetDrive("C:\")
    With aDrive
        Debug.Print "Volume Name: " & .VolumeName & vbCrLf
        Debug.Print "Free Space: " & Format(.FreeSpace / 1000000000#, "#0.00") & "GB" & vbCrLf
        Debug.Print "Total Size: " & Format(.TotalSize / 1000000000#, "#0.00") & "GB" & vbCrLf
        Debug.Print "Ready: " & .IsReady
    End With
    Set myFileSystemObject = Nothing
    Set aDrive = Nothing
End Sub

Private Sub AddFolders()

 








Related examples in the same category

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