Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Network Drives Keith New Users to Excel 2 July 6th 06 10:38 PM
hyperlinks in different drives cdroot4383 Excel Discussion (Misc queries) 2 January 5th 06 07:35 PM
This drives me nuts Pete K Excel Programming 5 April 9th 04 10:49 PM
Removable drives MarkS Excel Programming 1 January 13th 04 01:47 AM
Network drives [email protected] Excel Programming 0 July 17th 03 04:37 AM


All times are GMT +1. The time now is 10:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"