Get Drive Type
This API code will circle through all your dives and tell you what the drive type is.
If you put the declare under the form then you have to put "Private" in front of the declare statment.
If however you want to put it in a module then you can just cut and paste the declare statment and
remove the "Private" in front of the declare statement.
Add a lable to the from(Lable1)
=======================================================================
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" _
(ByVal nDrive As String) As Long
Private Const DRIVE_CDROM = 5
Private Const DRIVE_FIXED = 3
Private Const DRIVE_RAMDISK = 6
Private Const DRIVE_REMOTE = 4
Private Const DRIVE_REMOVABLE = 2
Public Sub DriveType()
Dim strDrive, rtn As String
Dim strMessage As String
Dim intCnt As Integer
For intCnt = 65 To 86
strDrive = Chr(intCnt)
Select Case GetDriveType(strDrive + ":\")
Case DRIVE_REMOVABLE
rtn = "Floppy Drive"
Case DRIVE_FIXED
rtn = "Hard Drive"
Case DRIVE_REMOTE
rtn = "Network Drive"
Case DRIVE_CDROM
rtn = "CD-ROM Drive"
Case DRIVE_RAMDISK
rtn = "RAM Disk"
Case Else
rtn = ""
End Select
If rtn <> "" Then
strMessage = strMessage & vbCrLf & "Drive " & strDrive & " is type: " & rtn
End If
Next intCnt
MsgBox (strMessage)
End Sub
Private Sub Form_Click()
DriveType
End Sub
Private Sub Form_Load()
Label1 = "Click on Form to get results"
End Sub