Pagina precedente | 1 | Pagina successiva
Vota | Stampa | Notifica email    
Autore

errore run time 9

Ultimo Aggiornamento: 01/03/2017 18:38
Post: 385
Registrato il: 28/05/2011
Città: MILANO
Età: 43
Utente Senior
excel 2000/2007
OFFLINE
28/02/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
---------------
excel 2007
Post: 3.734
Registrato il: 13/03/2012
Città: LIVORNO
Età: 78
Utente Master
2010
OFFLINE
01/03/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

----------
Win 10 - Excel 2010
allega un file di esempio, guadagnerai tempo tu e lo farai risparmiare a chi ti aiuta
Post: 385
Registrato il: 28/05/2011
Città: MILANO
Età: 43
Utente Senior
excel 2000/2007
OFFLINE
01/03/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


---------------
excel 2007
Post: 3.736
Registrato il: 13/03/2012
Città: LIVORNO
Età: 78
Utente Master
2010
OFFLINE
01/03/2017 18:38

questa sarebbe la risposta al mio consiglio ?

----------
Win 10 - Excel 2010
allega un file di esempio, guadagnerai tempo tu e lo farai risparmiare a chi ti aiuta
Vota:
Amministra Discussione: | Chiudi | Sposta | Cancella | Modifica | Notifica email Pagina precedente | 1 | Pagina successiva
Nuova Discussione
 | 
Rispondi
Cerca nel forum
Tag discussione
Discussioni Simili   [vedi tutte]
errore di run time (12 messaggi, agg.: 10/04/2018 22:48)
Feed | Forum | Bacheca | Album | Utenti | Cerca | Login | Registrati | Amministra
Tutti gli orari sono GMT+01:00. Adesso sono le 22:24. Versione: Stampabile | Mobile | Regolamento | Privacy
FreeForumZone [v.6.1] - Copyright © 2000-2024 FFZ srl - www.freeforumzone.com