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
| 'Ouvre le classeur Excel
On Error GoTo PbAppli
Set App_xls = CreateObject("Excel.Application") 'Ouvre Excel
On Error GoTo PbFic
Set Classeur_xls = App_xls.Workbooks.Open(Rapport_str)
Set Page_xls = Classeur_xls.Worksheets.Add
'Entête de la page
Lec_int = 1
Page_xls.Cells(Lec_int, 1) = "Déclaration pour l'anné " & AnRef_lst.Text
Page_xls.Range("A1").Font.Bold = True
'Lecture des demandeurs
Req_str = "SELECT decl.IdDeclaration, dem.nom, dem.prenom, dem.adresse1, dem.adresse2, dem.cp, comm.nom " _
<div style="margin-left:40px">& "FROM declaration decl, demandeur dem, commune comm " _</div><div style="margin-left:40px">& "WHERE decl.demandeur = dem.demandeur AND dem.ville = comm.code " _</div><div style="margin-left:40px">& "AND AnDeclaration = '" & AnRef_lst.Text & "' " _</div><div style="margin-left:40px">& "ORDER BY dem.nom, dem.prenom"</div>RecSet.Open Req_str, FDC_cnx, adOpenForwardOnly, adLockReadOnly
Do While Not RecSet.EOF
<div style="margin-left:40px">Lec_int = Lec_int + 1</div>Page_xls.Cells(Lec_int, 1) = "Demandeur :"
<div style="margin-left:40px">Page_xls.Range("A" & Lec_int).Font.Bold = True</div><div style="margin-left:40px">Page_xls.Cells(Lec_int, 1) = RecSet.Fields("dem.nom") & " " & RecSet.Fields("prenom") _</div><div style="margin-left:40px"><div style="margin-left:40px">& " " & RecSet.Fields("adresse1") & " " & RecSet.Fields("adresse2") & " " & RecSet.Fields("cp") _</div></div>& " " & RecSet.Fields("comm.nom")
<div style="margin-left:40px">RecSet.MoveNext</div>Loop
RecSet.Close
Classeur_xls.Save
Classeur_xls.Close
Set Page_xls = Nothing
Set Classeur_xls = Nothing
Set App_xls = Nothing |
Partager