1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| Dim rst As DAO.Recordset
Dim compteEnr As Long, chMsg As String
Dim varRetournée As Variant, lngX As Long
Dim appexcel As Excel.Application
Dim wbexcel As Excel.Workbook
Dim temp As Variant
Set db = CurrentDb()
Set appexcel = CreateObject("Excel.Application")
'-> Si true excel s'affiche à l'écran
appexcel.Visible = True
'->ouverture du fichier excel,
Set wbexcel = appexcel.Workbooks.Open("F:\User\AGENCE CENTRE EST\ANNEE 2006\Groupe eau potable - légionelles\Pierre\Devis PMCA.xls")
'->selection de la feuille,
appexcel.Sheets("FICHE de MESURE Légio NFT ").Select
'-> ouverture de la table
Set rst = db.OpenRecordset("Site intervention")
'-> modification des données dans excel
appexcel.Cells(4, 4) = rst![Société intervention]
appexcel.Cells(5, 5) = rst![ville intervention]
appexcel.Cells(5, 4) = rst![Adresse intervention]
Set rst = db.OpenRecordset("Employé")
appexcel.Cells(3, 4) = rst![Nom]
appexcel.Cells(3, 5) = rst![Prenom]
Set rst = db.OpenRecordset("Contact intervention")
appexcel.Cells(9, 5) = rst![nom contact intervention]
appexcel.Cells(9, 4) = rst![prenom contact intervention]
Set rst = db.OpenRecordset("Devis")
appexcel.Cells(5, 38) = rst![Ref Devis]
Set rst = db.OpenRecordset("Pts de prelevement")
intLigne = 15
While Not intLigne = 20
appexcel.Cells(intLigne, 4) = rst![Désignation du pt de prvt]
appexcel.Cells(intLigne, 1) = rst![Désignation du pt de prvt]
rst.MoveNext
intLigne = intLigne + 1
Wend
rst.Close
db.Close
Set appexcel = Nothing |
Partager