I am trying to obtain a list of drives for searching for the user to select from for certain documents and I am having a little bit of a problem with the drive scan. The code I am just testing out at this point is failing on a removable drive ex drive A: and errors out of the program. The code is as follows:


Sub ShowDriveList()
Dim fs, d, dc, s, n
set fs = CreateObject("Scripting.FileSystemObject")
set dc = fs.Drives
for Each d In dc
s = s & d.DriveLetter & " - "
If d.DriveType = Remote then
n = d.ShareName
else
n = d.VolumeName
End If
s = s & n & vbCrLf
next
MsgBox s
End Sub




Right now when run if I have a disk in drive A: it works fine but if I don't have one it doesn't. Is there a way around this?

Thanks.