OVH Cloud OVH Cloud

Activate me fait défaut ?

1 réponse
Avatar
John
Bonjour tout le monde,

J'ai une application access qui ouvre un fichier excel.
Voici un extrait du code où cela se passe :

Dim xlApp As Excel.Application

repCible = Command() & MONREP & "\rep_imp"
repSource = Command() & MONREP & "\rep_tra"
RepCharge = Command() & MONREP & "\rep_res"

Set xlApp = CreateObject("Excel.Application")

nomFichier = "CIE037" + Left(nomform, 3) + Left(dateSemn, 4) +
Left(Right(dateSemn, 5), 2) _
+ Right(dateSemn, 2) + noCouvoir + DeclarNo + ".xls"

xlApp.Workbooks.Open (repSource + "\" + nomform)
xlApp.ActiveWorkbook.Worksheets("Introduction").Activate


Le code fonctionne très bien sur mon poste mais une fois que je l'excécute à
partir d'un autre poste j'ai une erreur sur la dernière ligne !
(xlApp.ActiveWorkbook.Worksheets("Introduction").Activate)
Quelque'un aurait-il une idée du pourquoi et du comment ??
Merci de vos réponses

1 réponse

Avatar
JpPradier
Bonjour John
Je serais tenté de dire que le Activeworkbook n'est pas le bon. Essaye en mettant cette ligne avant
la ligne incriminée :

Msgbox xlApp.ActiveWorkbook.Name


j-p