From: danpt on
Please help
Thanks

Sub Macro1()
' On each stick memory, I will have a book named as 'IDnumber.xls'
' I'm attempting to identify which drive that has 'IDtestnumber.xls'
' This script supposed to do that, but I kept getting 'Run-time error 1004'
' Memory stick keeps changing drive letter. Is there a way to identify them?
' If they have ID No., how do I find out the drive letter associated with
that ID No.?
Dim i As Long
Dim drive, driveletter As String
Application.ScreenUpdating = False
For i = 1 To 16
drive = Application.Choose(i, "E:", "F:", "G:", "H:", "I:", "J:")
On Error GoTo skip1
Workbooks.Open Filename:=drive & "\IDtestnumber.xls", UpdateLinks:=0
' If Error = Error(1004) Then GoTo skip1
Workbooks("IDtest.xls").Close SaveChanges:=False
GoTo skip2
skip1:
Next i
skip2:
driveletter = drive
End Sub