Thread: flash drives
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ricksimm[_5_] ricksimm[_5_] is offline
external usenet poster
 
Posts: 1
Default flash drives

Sub FindFlashDrive()
Dim fs, d
Dim AllCells As Range, cell As Range
Dim t As String
Set fs = CreateObject("Scripting.FileSystemObject")
Set AllCells = Range("DriveLetters",
Range("DriveLetters").End(xlDown))
t = ""
On Error GoTo ERR1
For Each cell In AllCells
Set d = fs.GetDrive(cell.Value)
Select Case d.DriveType
Case 0: t = "Unknown"
Case 1: t = "Removable"
Case 2: t = "Fixed"
Case 3: t = "Network"
Case 4: t = "CD-ROM"
Case 5: t = "RAM Disk"
End Select
If t = "Removable" Then Exit For
Next cell
If t = "" Then Exit Sub
FlashDriveLetter = cell.Value
On Error GoTo 0
Exit Sub
ERR1:
On Error GoTo 0
FlashDriveLetter = ""
End Sub

I use this code to detect a flash drive in Excel. The code will detect a
Fuji flash drive. When I try to detect a Pocket Rocket flash drive I get a
run-time error 68- device unavailable. Can anyone help? thanks.