Creation d'un fichier PDF par "PDFCreator" en vba

elgringo123456

XLDnaute Occasionnel
Supporter XLD
Bonjour,

Je me permets de vous solliciter sur l'aspect suivant : création d'un fichier pdf à partir d'un fichier power point le tout en vba

En excel j'ai le code me permettant de générer le fichier excel au format PDF via PDF Creator.
Apres lecture de doc sur Internet , je n'arrive pas à changer l'active Printer (à priori) me permettant de sortir le fichier en pdf et non de passer à l'impression.

Vous trouverez le fichier en pièce jointe au format ppt avec un code vba => mais cela ne marche pas.

Pourriez-vous m'aider ?

Merci d'avance de vos suggestions,
Cordialement.
ElGringo123456
 

Pièces jointes

  • Présentation1.zip
    29.4 KB · Affichages: 107
  • Présentation1.zip
    29.4 KB · Affichages: 106
  • Présentation1.zip
    29.4 KB · Affichages: 102
C

Compte Supprimé 979

Guest
Re : Creation d'un fichier PDF par "PDFCreator" en vba

Bonjour,

Ca Kiki29, désolé de te le dire, mais je sais faire ... :rolleyes:
mais ça ne fonctionne pas sous PPT

@elgringo, voici un code modifié pour tes besoins
VB:
Sub PrintToPDF_Early()
  'Author       : Ken Puls ([url=http://www.excelguru.ca]Excelguru.ca | Tips and pointers for Excel and other MS Office applications[/url])
  'Macro Purpose: Print to PDF file using PDFCreator
  '   (Download from [url=http://sourceforge.net/projects/pdfcreator/]SourceForge.net: PDFCreator[/url])
  '   Designed for early bind, set reference to PDFCreator
  Dim pdfjob As PDFCreator.clsPDFCreator
  Dim sPDFName As String
  Dim sPDFPath As String
  '/// Change the output file name here! ///
  sPDFName = "testPDF.pdf"
  sPDFPath = ActivePresentation.Path & "\"
  
  Set pdfjob = New PDFCreator.clsPDFCreator
  With pdfjob
    If .cStart("/NoProcessingAtStartup") = False Then
      MsgBox "Can't initialize PDFCreator.", vbCritical + _
                                             vbOKOnly, "PrtPDFCreator"
      Exit Sub
    End If
    .cOption("UseAutosave") = 1
    .cOption("UseAutosaveDirectory") = 1
    .cOption("AutosaveDirectory") = sPDFPath
    .cOption("AutosaveFilename") = sPDFName
    .cOption("AutosaveFormat") = 0    ' 0 = PDF
    .cClearCache
  End With
  'Print the document to PDF
  ActivePresentation.PrintOptions.ActivePrinter = "PDFCreator"
  ActivePresentation.PrintOut copies:=1
  'Wait until the print job has entered the print queue
  Do Until pdfjob.cCountOfPrintjobs = 1
    DoEvents
  Loop
  pdfjob.cPrinterStop = False
  'Wait until PDF creator is finished then release the objects
  Do Until pdfjob.cCountOfPrintjobs = 0
    DoEvents
  Loop
  pdfjob.cClose
  Set pdfjob = Nothing
End Sub

A+
 

Discussions similaires

Statistiques des forums

Discussions
312 329
Messages
2 087 334
Membres
103 520
dernier inscrit
Azise