Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Check your other post.
danpt wrote: 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 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
run time error 1004 | Excel Discussion (Misc queries) | |||
run time error 1004 | Excel Worksheet Functions | |||
Run Time error 1004 | Excel Discussion (Misc queries) | |||
Run time error 1004 | Excel Discussion (Misc queries) | |||
Run time error 1004, General ODBC error | New Users to Excel |