J'ai un problème avec la sauvegarde en fin de procédure (appexcel.save). Excel me demande si je veux enregistrer "resume.xlw" A quoi fait -il référence alors que le fichier ouvert est test.xls ?
Comment valider l'enregistrement automatiquement ?
merci

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Dim appexcel As Excel.Application
Dim db As Database, rst As Recordset
 
 
Set db = CurrentDb
 
Set rst = db.OpenRecordset("1Effectifs DOM & Métropole", dbOpenDynaset)
 
Set appexcel = CreateObject("Excel.Application")
appexcel.Visible = False
Set wbexcel = appexcel.Workbooks.Open("G:\ETUDES\ARCHIVES\Commandes mensuelles\test.xls")
appexcel.Sheets("effectifs").Select
appexcel.cells(10, 4) = rst![nb agt]
rst.MoveNext
appexcel.cells(6, 4) = rst![nb agt]
 
appexcel.Visible = True
appexcel.Save
appexcel.Quit
Set appexcel = Nothing
 
rst.Close