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
| Set appexcel = CreateObject("Excel.Application")
appexcel.Visible = True
Dim i As Integer
i = 5
Dim LaDate As Date
Dim echeance As Integer
Dim prixRestant As Integer
Set wbexcel = appexcel.Workbooks.Open("monchemin.xls")
appexcel.Sheets("Feuil1").Select
appexcel.cells(2, 2) = rstclose2!AggloInstal
appexcel.cells(2, 6) = txtcloture.Value
Dim GTotal As Integer
GTotal = 0
Do Until rstclose2.EOF
LaDate = txtcloture.Value
echeance = Abs((DateDiff("m", DateSerial(Year(rstclose2!Date_Effet) + 3, Month(rstclose2!Date_Effet) + 1, 0), DateSerial(Year(LaDate), Month(LaDate) + 1, 0))))
prixRestant = echeance * Cout_Loyer
appexcel.cells(i, 1) = rstclose2!Designation
appexcel.cells(i, 2) = rstclose2!Prix_Achat
appexcel.cells(i, 3) = rstclose2!Date_Effet
appexcel.cells(i, 4) = rstclose2!Cout_Loyer
appexcel.cells(i, 5) = echeance
appexcel.cells(i, 6) = rstclose2!Cout_Loyer * echeance
appexcel.cells(i, 7) = rstclose2!CompteDeRef_Materiel
appexcel.cells(i, 8) = rstclose2!Cout_Loyer * rstclose2!CompteDeRef_Materiel * echeance
GTotal = GTotal + rstclose2!Cout_Loyer * rstclose2!CompteDeRef_Materiel * echeance
rstclose2.MoveNext
i = i + 1
Loop
appexcel.cells(i, 1) = "Grand Total"
appexcel.cells(i, 8) = GTotal
rstclose2.Close |
Partager