Two ways of doing it: using API or the FileSystemObject..
*** API ***
Private Declare Function GetDriveType Lib "kernel32.dll" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Const DRIVE_REMOVABLE = 2
Private Const DRIVE_FIXED = 3
Private Const DRIVE_REMOTE = 4
Private Const DRIVE_CDROM = 5
Private Const DRIVE_RAMDISK = 6
Private Sub GetDriveTypeWithAPI()
Dim liDriveType As Long
Dim lsDescription As String
liDriveType = GetDriveType("c:\"
Select Case liDriveType
Case 2: lsDescription = "Removable"
Case 3: lsDescription = "Fixed"
Case 4: lsDescription = "Network"
Case 5: lsDescription = "CD-ROM"
Case 6: lsDescription = "RAM Disk"
Case Else: lsDescription = "Unknown"
End Select
MsgBox "Drive type: " & lsDescription
End Sub
*** FSO ***
Private Sub GetDriveTypeWithFSO()
Dim loFSO As FileSystemObject
Dim loDrive As Drive
Dim lsDescription As String
Set loFSO = New FileSystemObject
Set loDrive = loFSO.GetDrive("c:\"
Select Case loDrive.DriveType
Case 0: lsDescription = "Unknown"
Case 1: lsDescription = "Removable"
Case 2: lsDescription = "Fixed"
Case 3: lsDescription = "Network"
Case 4: lsDescription = "CD-ROM"
Case 5: lsDescription = "RAM Disk"
End Select
MsgBox "Drive type: " & lsDescription
Set loFSO = Nothing
End Sub
Remedy