Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Network Drives | New Users to Excel | |||
hyperlinks in different drives | Excel Discussion (Misc queries) | |||
This drives me nuts | Excel Programming | |||
Removable drives | Excel Programming | |||
Network drives | Excel Programming |