Impression pdf creator

lebtibo33 -  
cs_Le Pivert Messages postés 7904 Date d'inscription   Statut Contributeur Dernière intervention   -
Bonjour à tous,
j'ai créé un programme pour mon entreprise afin de créer des bons de livraison sous excel.
J'ai, dans ce programme, créé une macro pour imprimer avec pdf creator.
cette macro marchait très bien jusqu'à la dernière mise à jour de pdf creator.
Je ne trouve plus la référence PDF creator dans visual basic editor.

pour info je travail sur microsoft office 2010
et la nouvelle version de pdf creator est 2.0 avant celle là j'avais la 1.7



et donc j'ai un messge d'erreur : erreur d'execution 429
Un composant ActiveXne peut pas créer d'objet.

comment puis je faire?

voici mon code vba:

Public Sub Test1()

Dim pdfjob
Dim NomExcel, NomPdf, DefaultPrinter
Set pdfjob = CreateObject("PDFCreator.clsPDFCreator")
Dim Chemin As String, Fich As String, rep

Chemin = Workbooks(ActiveWorkbook.Name).Path & "\historique"
Fich = Range("B21").Value & ".pdf"

rep = Dir(Chemin & "\" & Fich)
If rep = "" Then
MsgBox "le fichier n'existe pas création du fichier PDFCreator"
Impression:
With pdfjob
If .cStart("/NoProcessingAtStartup") = False Then
MsgBox "Impossible d'initialiser PDFCreator.", vbCritical + vbOKOnly, "PrtPDFCreator"
Exit Sub
End If
.cOption("UseAutosave") = 1
.cOption("UseAutisaveDirectory") = 1
.cOption("AutosaveDirectory") = Chemin
.cOption("AutosaveFilename") = Fich
.cOption("AutosaveFormat") = 0
.cClearCache
End With
ThisWorkbook.Sheets("Feuil1").PrintOut Copies:=1, ActivePrinter:="PDFCreator"
Do Until pdfjob.cCountOfPrintjobs = 1
DoEvents
Loop

pdfjob.cPrinterStop = False

Do Until pdfjob.cCountOfPrintjobs = 0
DoEvents
Loop
With pdfjob
.cDefaultPrinter = DefaultPrinter
.cClearCache
.cClose
End With

Else
réponse = MsgBox("le fichier existe voulez-vous le remplacer ?", vbYesNo)
If réponse = vbYes Then
MsgBox "Remplacement du fichier existant"
GoTo Impression
Else
MsgBox "Sortie de la procédure"
Exit Sub
End If
End If
Range("M22").Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:=Chemin & "\" & Fich _
, TextToDisplay:=" "
Range("M22").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Range("A1").Select

Dim a As String
Dim b As String
a = Range("M17")
b = Range("E11")
Sheets("Feuil3").Select
Range("A65536").End(xlUp).Offset(1, 0) = b
Range("B65536").End(xlUp) = -a

End Sub

merci d'avance
A voir également:

2 réponses

cameron_skynet Messages postés 536 Date d'inscription   Statut Membre Dernière intervention   55
 
Bonjour,
Personnellement, j'ai remis la version 1.7 car j'ai eu aussi des problèmes avec la version 2.
0
cs_Le Pivert Messages postés 7904 Date d'inscription   Statut Contributeur Dernière intervention   729
 
Bonjour,

Avec la version d'Excel que tu as, tu n'as pas besoin de PDF creator. Il te suffit d'enrgistrer en PDF. Si tu veux avoir le code en vba. Tu te sers de l'enregistreur de macros.
0