( Sources convertis en 6 couleurs avec mon programme VB to HTML)
Voila un apercu de l'impression :'=============================================================================== ' EXEMPLE D'UTILISATION DE L'OBJET EXCEL ' PERMET DE MODIFIER AVANT DE L'IMPRIMER UN DOCUMENT EXCEL ' EXCEL EST INVISIBLE POUR L'UTILISATEUR ' ET LE DOCUMENT EST INCHANGE APRES L'IMPRESSION ' ' EXCEL97 DOIT ETRE PRESENT SUR LE POSTE UTILISATEUR ' ' fred.just@free.fr ' Active Visual Basic ' http://www.fredjust.com '=============================================================================== Option Explicit 'Fichier template XLS Const FichierXLS = "test.xls" 'Varaible objet EXCEL 8.0 Dim xlApp As Excel.Application Dim xlBook As Excel.Workbook Dim xlRang As Excel.Range Dim xlSheet As Excel.Worksheet Dim i As Long '=============================================================================== ' '=============================================================================== Private Sub cmdPrint_Click() 'Création de l'objet EXCEL 8.0 Set xlApp = New Excel.Application With xlApp 'Ouverture du document XLS Set xlBook = .Workbooks.Open(FileName:=App.Path + "\" + FichierXLS, ReadOnly:=False, Editable:=True) 'Séléction de la feuille 1 Set xlSheet = xlBook.Worksheets(1) End With With xlSheet 'Modification de la zone nom 'une zone nom doit exister dans le template Set xlRang = .Range("nom") xlRang.Cells(1, 1) = txtNom 'modification des valeurs 'valeur est une zone de 10 cellule de haut Set xlRang = .Range("valeur") For i = 1 To 10 xlRang.Cells(i, 1) = CLng(txtValue(i - 1)) Next End With 'Impression du document xlBook.PrintOut 'Ferme le template XLS sans le sauvegarder xlBook.Close savechanges:=False 'Quitte l'instance EXCEL crée xlApp.Quit 'Détruit les objets Set xlRang = Nothing Set xlSheet = Nothing Set xlBook = Nothing Set xlApp = Nothing End Sub '=============================================================================== ' '=============================================================================== Private Sub Form_Load() For i = 0 To 9 txtValue(i) = CLng(Rnd() * (i + 1) * 100) Next End Sub