Quote:
Originally posted by jackbee
try this
Declare Function GetDriveType Lib "kernel32" _
Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Public Const DRIVE_CDROM = 5
'Get CD Drive ie D, E etc
Function GetCDSource() As String
Dim Srce$
Dim Index%
Dim DriveType As Long
For Index% = Asc("C") To Asc("Z")
DriveType& = GetDriveType(Chr$(Index%) & ":")
If DriveType& = DRIVE_CDROM Then
On Error GoTo NextIndex 'in case CD is empty
If Len(Dir(Chr$(Index%) & ":\",vbDirectory)) > 0 Then
Srce$ = Chr$(Index%)
Exit For
End If
End If
NextIndex:
Next Index%
GetCDSource = Srce$
End Function
There's a much easier way: