Erreur 9/non ouverture de fichier
Bonjour à tous,
J'ai l'erreur 9 qui apparait à la ligne: Dayfile = Left(Workbooks(file1).Sheets("ONUSER_ALARMS_24H").Cells(20, 3), 10) 'recover of the date. Select the case out of 3 that has the consistent excel tab name
L'erreur se produit seulement pendant le premier chargement du fichier extérieur et ça ne le fait pas sur tous les PC. L'erreur est produite car le fichier extérieur ne s'ouvre pas mais je ne sais pas pourquoi... Avez-vous une idée ?
Merci à tous !
Voilà le code:
Sub MM()
'
' MM Macro
'
'
Dim flag, flag2, flag3 As Boolean
Dim c, i, j, k, l, m, n, o, p As Integer
Dim filespec As Variant
file0 = Application.ActiveWorkbook.Name
'Selection of files to import
filespec = Application.GetOpenFilename '(MultiSelect:=True)
Application.ScreenUpdating = False
'Import Macro
'For i = 1 To UBound(filespec) 'opening of selected files to import, one by one
c = 0 'shelved alarms counter
Workbooks.Open (filespec) '(i)) 'file opening
Application.Wait (Now + TimeValue("00:00:10"))
'Workbooks.Open ("/Volumes/HD" & filespec) 'file opening
Workbooks(file0).Sheets("remarks").Cells(7, 1) = Time
file1 = Application.ActiveWorkbook.Name 'naming of file to import
Workbooks(file0).Sheets("remarks").Cells(20, 1) = Time
Workbooks(file0).Sheets("Buffer2").Cells.Delete
Workbooks(file0).Sheets("Buffer3").Cells.Delete
Dayfile = Left(Workbooks(file1).Sheets("ONUSER_ALARMS_24H").Cells(20, 3), 10) 'recover of the date. Select the case out of 3 that has the consistent excel tab name
'Dayfile = Left(Workbooks(file1).Sheets("ALARMS_ONUSER_24H").Cells(20, 3), 10)
'Dayfile = Left(Workbooks(file1).Sheets("ALARMS_24H").Cells(20, 3), 10)
j = 1 'Column number counter
p = 1