Sub Windows API Class

GetDriveTypeSample

Signature (Visual Basic / VBA)

Private Sub GetDriveTypeSample()
    ' Sample of the GetDriveType function that
    ' prints the type of each of the drives A through Z.

    Dim intAsc As Integer
    For intAsc = ASC("A") To ASC("Z")
        Dim strDrive As String
        strDrive = Chr$(intAsc) + ":"

        Dim lngType As Integer
        lngType = GetDriveType(strDrive)

        Dim strType As String
        strType = DRIVEConstantToString(lngType)

        Debug.Print "Drive " & strDrive & " Type " & lngType & " " & strType
    Next intAsc
End Sub