Salut le forum
J'ai essayé d'adapter un code que j'ai trouvé à mon besoin mais il ne fonctionne pas. Le comble est que quand je l'exécute, il fonctionne mais le résultat n'est pas concluant et il n'affiche aucun debogage.
Je sollicite votre aide afin qu'il puisse fonctionner.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
37
38 Option Explicit Sub ToPdf_BL() Dim Nomfic As String, spath As String, spath1 As String, NomPdf As String Dim pdfjob As Object Dim DefaultPrinter As Object Set pdfjob = CreateObject("PDFCreator.clsPDFCreator") spath = "\\serveur01\Logistique" & "\EXERCICES " & Format(Date, "yyyy") spath1 = spath & "\BORDEREAU DE LIVRAISON " & Format(Date, "yyyy") NomPdf = Sheets("Facturier").Range("R2").Value & ".pdf" With pdfjob If .cstart("/NoProcessingAtStartup") = False Then MsgBox "Can't initialize PDFCreator.", vbCritical + vbOKOnly, "PrtPDFCreator" Exit Sub End If .cOption("UseAutosave") = 1 .cOption("UseAutisaveDirectory") = 1 .cOption("AutosaveDirectory") = spath1 .cOption("AutosaveFilename") = NomPdf .cOption("AutosaveFormat") = 0 .cClearCache End With ThisWorkbook.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 Set pdfjob = Nothing End Sub
Partager