Imprimer une feuille excel avec vb

PENSSSIUMDK59 Messages postés 10 Date d'inscription vendredi 21 mai 2004 Statut Membre Dernière intervention 6 octobre 2004 - 2 juin 2004 à 12:05
ucfoutu Messages postés 18038 Date d'inscription lundi 7 décembre 2009 Statut Modérateur Dernière intervention 11 avril 2018 - 7 sept. 2012 à 18:19
Bonjour tout le monde !!!

j ai besoin d'un coup de main !!!

Je voudrais imprimer une feuille excel a partir de visual basic
je n arrive pas a trouver le code correspondant

je sais l'activer , y écrire des infos dessus l enregistrer mais j arrive pas a imprimer !!!

Si vous pouvez aider moi svp

C est important enfin pour moi
Merci d avance

PEN$$$$IUM de St pol :-)

3 réponses

Rajah174 Messages postés 10 Date d'inscription jeudi 19 juin 2003 Statut Membre Dernière intervention 16 juin 2004
2 juin 2004 à 15:38
Salut,

essaye ActiveSheet.PrintOut

ça devrait marcher.
0
bonjour tt le monde bein j ai un probleme quand je tente imprimer sur excel sous vb 6 voila mon code
il m affiche un message d erreur il ma ffiche un message d errer cant found of library meme si j ai coche microsodt excel 14.0 object library
Private Sub Cmdimprime_Click()
Dim monexcel As Excel.application
Set monexcel = New Excel.application

monexcel.Workbooks.Add
monexcel.ActiveWorkbook.ActiveSheet.Range("A1") = "Code client"
monexcel.ActiveWorkbook.ActiveSheet.Range("A2") = "Nom du contact"
monexcel.ActiveWorkbook.ActiveSheet.Range("A3") = "Adresse"
monexcel.ActiveWorkbook.ActiveSheet.Range("A4") = "pays"
monexcel.ActiveWorkbook.ActiveSheet.Range("A5") = "Ville"
monexcel.ActiveWorkbook.ActiveSheet.Range("A6") = "Tel"
monexcel.ActiveWorkbook.ActiveSheet.Range("A7") = "gsm du contact"
monexcel.ActiveWorkbook.ActiveSheet.Range("A8") = "fax"
monexcel.ActiveWorkbook.ActiveSheet.Range("A9") = "E-mail"
monexcel.ActiveWorkbook.ActiveSheet.Range("A10") = "raison social"
monexcel.ActiveWorkbook.ActiveSheet.Range("A11") = "Rc"
monexcel.ActiveWorkbook.ActiveSheet.Range("A12") = "Autres informations"

monexcel.ActiveWorkbook.ActiveSheet.Range("B1") = cboCodeClient.Text
monexcel.ActiveWorkbook.ActiveSheet.Range("B2") = txtNom.Text
monexcel.ActiveWorkbook.ActiveSheet.Range("B3") = Txtadresse.Text
monexcel.ActiveWorkbook.ActiveSheet.Range("B4") = txtPays.Text

monexcel.ActiveWorkbook.ActiveSheet.Range("B5") = TxtVille.Text
monexcel.ActiveWorkbook.ActiveSheet.Range("B6") = TxtTel.Text
monexcel.ActiveWorkbook.ActiveSheet.Range("B7") = TxtGsm.Text
monexcel.ActiveWorkbook.ActiveSheet.Range("B8") = TxtFax.Text

monexcel.ActiveWorkbook.ActiveSheet.Range("B9") = TxtEmail.Text
monexcel.ActiveWorkbook.ActiveSheet.Range("B10") = TxtRaisonSocial.Text
monexcel.ActiveWorkbook.ActiveSheet.Range("B11") = TxtRc.Text
monexcel.ActiveWorkbook.ActiveSheet.Range("B") = TxtAutres.Text

On Error Resume Next
Kill "c:\fi.xls"
monexcel.ActiveWindow.SelectedSheets.PrintOut

monexcel.Workbooks.Close
Set monexcel = Nothing

End Sub

merci
0
ucfoutu Messages postés 18038 Date d'inscription lundi 7 décembre 2009 Statut Modérateur Dernière intervention 11 avril 2018 219
7 sept. 2012 à 18:19
Bonjour,
Je ne vois pas d'erreur là où tu dis qu'elle est (à condition que la référence cochée corresponde bien à la version de Excel présente).
Je vois par contre une autre erreur, lorsque tu auras réglé la 1ère, ici :

monexcel.ActiveWorkbook.ActiveSheet.Range("B") = TxtAutres.Text

________________________
Réponse exacte ? => "REPONSE ACCEPTEE" pour faciliter les recherches.
Pas d'aide en ligne installée ? => ne comptez pas sur moi pour simplement vous dire ce qu'elle contient. Je n'interviendrai qu'en cas de nécessité de développ
0