john_cash
00martedì 28 febbraio 2017 21:31
Ciao a tutti,
ho questa parte di macro che mi dà errore di run time 9
indice incluso nell'intervallo qui
'-----------------------------------------------------------
If UBound(FoundFiles, 1) >= 0 Then
For cartella = 1 To UBound(FoundFiles, 1) - 1
On Error Resume Next
Workbooks.Open FoundFiles(cartella, 1) & "\" & FoundFiles(cartella, 2) '<<<<<
If Err.Number = 9 Then
MsgBox "The path """ & Path & """ is missing or the name has been changed.", vbCritical, "Path Error"
Exit Sub
End If
On Error GoTo 0
nome_file = ActiveWorkbook.Name
-------------------------------------------------------------
un aiuto?
Grazie
john
patel45
00mercoledì 1 marzo 2017 09:30
impossibile rispondere senza conoscere il contenuto di FoundFiles(cartella, 1)
lancia la macro step by step con F8 e controlla il contenuto delle variabili
john_cash
00mercoledì 1 marzo 2017 18:13
Application.ScreenUpdating = False
With ThisWorkbook.Worksheets("RICERCA")
Comm1 = .Range("B3").Value '<<< nome cella 1
Comm2 = .Range("B4").Value '<<< nome cella 2
Comm3 = Comm1 & "-" & Comm2 '<<< unite
End With
Path = Path & Comm3
Call GetSubFolders(Path, FoundFiles, -1)
FoundFiles = Application.Transpose(FoundFiles)
If UBound(FoundFiles, 1) >= 0 Then
For cartella = 1 To UBound(FoundFiles, 1) - 1
On Error Resume Next
Workbooks.Open FoundFiles(cartella, 1) & "\" & FoundFiles(cartella, 2)
If Err.Number = 9 Then
MsgBox "il percorso/path < " & Path & " >" & Chr(13) & _
"non è eatto o il nome è stato cambiato.", vbCritical, "ERRORE PATH"
Exit Sub
End If
On Error GoTo 0
nome_file = ActiveWorkbook.Name
patel45
00mercoledì 1 marzo 2017 18:38
questa sarebbe la risposta al mio consiglio ?