Log in

View Full Version : Print PPT to PDF file



ell_
11-22-2017, 05:08 PM
Hi, all. I have this one program where it can transfer the data from Excel to PowerPoint. I have to add another feature in my code that runs from Excel, which is to convert or print the active PPT file to PDF. The issue is I can't seem to find the solution for this. I only have a code that do the conversion but runs from PPT only, not Excel.

Code that runs from PPT to convert PPT slides to PDF:

Public Sub ExportAsFixedFormat_Example()
ActivePresentation.ExportAsFixedFormat "C:\Users\my097a\Desktop\test.pdf", ppFixedFormatTypePDF, ppFixedFormatIntentScreen, msoCTrue, ppPrintHandoutHorizontalFirst, ppPrintOutputSlides, msoFalse, , , , False, False, False, False, False
End Sub


Hereby I attached my Excel file for you to refer to along with the PPT template. 2102221023

May I also know how to add a feature in which user is prompted to select the folder of the pdf file to be saved and the user may name the pdf file as well?

Hope anyone can enlighten me. Thanks!

macropod
11-22-2017, 08:45 PM
Cross-posted at: https://www.excelforum.com/excel-programming-vba-macros/1209662-converting-active-ppt-to-pdf.html
Please read VBA Express' policy on Cross-Posting in item 3 of the rules: http://www.vbaexpress.com/forum/faq.php?faq=new_faq_item#faq_new_faq_item3

ell_
11-22-2017, 09:07 PM
Hi macropod,

How can I solve the issue then? Should I ask anyone to delete my thread?

macropod
11-22-2017, 09:08 PM
Kindly read the rules on both forums...

ell_
11-22-2017, 10:02 PM
Yes, have read both.

John Wilson
11-23-2017, 06:48 AM
You are using Late Binding in Excel. Since this does not include a reference to PPT the pp constants you use are meaningless in Excel

You must define them:


Const ppFixedFormatTypePDF As Long = 2
Const ppFixedFormatIntentScreen As Long = 1
Const ppPrintHandoutHorizontalFirst As Long = 2
Const ppPrintOutputSlides As Long = 1