Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print PowerPoint Slides to PDF with 2 slides on 1 PDF page with PDFCreator

Status
Not open for further replies.

roccorockz

Technical User
Oct 12, 2013
2
DE
Hi everyone,

I set up a code which first transfers my Excel 2010 charts to PowerPoint and then prints the PowerPoint slides to PDF, but since I have in general many slides I do not want to have half of a tree each time when I start the print job. It's totally sufficient to have 2 PP slides on 1 PDF page. I use the PDFCreator. Does anyone know how to setup the respective code in Excel 2010 VBA?

Many thanks beforehand for any answer.

Rocco
 
I use this to convert Word 2 PDF via PDFCreator.

Code:
Function Word2PDF(ByVal sDoc As String, ByVal sPDF As String) As Boolean

    On Error GoTo EH_Word2PDF

    Dim oPDF As Object
    Dim sDefaultPrinter As String
    Dim oWord As Object
    Dim sOutputFilename As String
    Dim c As Integer
    
    'Create Instances
    Set oPDF = CreateObject("PDFCreator.clsPDFCreator")
    Set oWord = CreateObject("Word.Application")
    sPDFDoc = ""
    
    Word2PDF = True
    
    'Open document
    oWord.Documents.Open sDoc
    
    With oPDF
        .cStart "/NoProcessingAtStartup"
        .cOption("UseAutosave") = 1
        .cOption("UseAutosaveDirectory") = 1
        .cOption("AutosaveDirectory") = oWord.ActiveDocument.Path
        .cOption("AutosaveFilename") = sPDF
        .cOption("AutosaveFormat") = 0
        sDefaultPrinter = .cDefaultPrinter
        .cDefaultPrinter = "PDFCreator"
        oWord.PrintOut Background:=True
        .cClearCache
        .cPrinterStop = False
    End With
 
    DoEvents ' let OS do its thing
 
    ' wait 30 seconds!
    c = 0
 
    Do While (Nz(oPDF.cOutputFilename, "") = "") And (c < 30)
        c = c + 1
        Sleep 1000
    Loop

    sOutputFilename = oPDF.cOutputFilename
    
    With oPDF
        .cDefaultPrinter = sDefaultPrinter
        Sleep 200
        .cClose
    End With
    
    DoEvents ' let OS do its thing

    Sleep 2000 ' Wait until PDFCreator is removed from memory

    If Nz(sOutputFilename, "") = "" Then
        MsgBox "Error Creating pdf file. Timeout!"
    Else
        sPDFDoc = sOutputFilename
    End If

Exit_Word2PDF:

    Call closeWord(oWord)
    Set oPDF = Nothing
    Set oWord = Nothing
    Exit Function

EH_Word2PDF:
    MsgBox "There was an error converting Word2PDF ->" & Error(err) & ", " & CStr(err)
    Word2PDF = False
    Resume Exit_Word2PDF

End Function

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
Hi 1dmf,

Thank you for your reply. Unfortunately it doesn't solve my actual problem. My problem is too print 2 sides of a source document ( this can be PowerPoint slides, Word sides, etc. ) on 1 PDF page with PDFCreator. Do you know how to do this?

Anyone else maybe, too?

Regards
 
You need to tell PowerPoint how many slides to print on a page.

It is a standard print option of PowerPoint, what code do you currently have where you are manipulating a PowerPoint object and setting the slides per page option?


"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top