How to create a PDF document from a macro command in powerpoint2013

Source: Internet
Author: User
Tags versions

turn on macro command function

In PowerPoint 2013, for example, the operations of other versions are slightly different.

Click menu: file → options → custom ribbon → main tab, tick "development tools". or find "macros" directly in all commands and add them to the custom menu.

Click the "Development tool" menu, you can see the "Macros" icon in the common toolbar "code"

Enable Macros and enter the appropriate VBA code

Procedure: 1. On the Development Tools tab, in the code group, click Macros. If the Development Tools tab is not available, see the Developer tab displayed. 2. In the Macro dialog box, in the Macro name box, type a name for the macro, such as a PDF. 3. In the macro action list, click the template or presentation that you want to store the macro in. The default is the active document and does not need to be changed. 4. In the Description box, type a description of the macro. Can not fill in. 5. Click Create to open the Visual Basic for applications.

Copy the copy of the code between the following----to the Open Macro Command Code window, and Save:----

Sub saveaspdf ()

Activepresentation.exportasfixedformat Activepresentation.path & "" & Activepresentation.name & ". pdf", Ppfixedformattypepdf, Ppfixedformatintentprint

End Sub

----Code Explanation:

Activepresentation.exportasfixedformat exports the PPT document, using the parameter settings to export to the corresponding format.

Activepresentation.path & "" & Activepresentation.name &. pdf "Save the PPT document as a PDF in the current directory, with the file name in ppt."

Here you can change the relative reference to a mixed reference, such as: "D:data" & Activepresentation.name & ". pdf";

or absolute reference, such as: D:dataa.pdf "

To organize the source of the code:

Original detailed code: https://msdn.microsoft.com/en-us/library/office/ff746080.aspx, there are related to a series of corresponding parameters, code explanation, you can further study the reference.

Between----is code:

----

Public Sub exportasfixedformat_example ()

Activepresentation.exportasfixedformat "C:usersusernamedocumentstest.pdf", Ppfixedformattypepdf, Ppfixedformatintentscreen, msoCTrue, Ppprinthandouthorizontalfirst, ppPrintOutputBuildSlides, MsoFalse,,,, False, False, False, False, False

End Sub

----

The following error may occur at run time:

The reason is that the teaching plan on the number of parameters set too much, the ppfixedformatintentscreen after the redundant parameters are deleted.

Here is the simplified code referenced in this article, which can be run effectively without error.

http://www.free-power-point-templates.com/articles/vba-macro-save-a-powerpoint-presentation-to-pdf-programmatically/

Add a key to run a macro command function

There are two methods:

1. File → options → custom ribbon → select commands → macros → add to custom menu from the following locations.

2. Files → options → quick access Toolbar → select commands → macros → add to custom menu from the following locations.

NOTE: Macro command-generated buttons, whether in a common toolbar or in the Quick Launch toolbar, are generally available only when you open a file that has a macro command, running in the active PPT file.

PowerPoint2013 files that contain macro commands need to be saved in the PPTM format to save the macro's VBA code.

Extended Application

Can be combined with Excel data list, with PPT design Christmas card, quickly converted to PDF, sent to customers.

Prepare list: Field name:

Company, name, address, email, etc.

In a PPT that has already been set up, open the development tools feature, run the macro, and add the following code: Sub PDF ()

Activepresentation.exportasfixedformat "C:usersusersdesktopchristmas2015.pdf", Ppfixedformattypepdf, Ppfixedformatintentscreen

End Sub

The path code in the directory can be changed, and this is the default desktop location.

Then save the PPT as a pptm file.

Use the above operation "add a key to run the macro command function" to add a temporary create a PDF button, you can create a PowerPoint key PDF to the desktop.

Modify the title, and after the PDF is generated, drag the desktop christmas2015.pdf to the message.

After the successful delivery of the message, and then modify the title to another customer, a key to generate Christmas2015.pdf overwrite the original desktop files. In turn, you know the greeting cards that quickly send out all the electronic versions of PDFs.

PPT generated PDF files, such as the background is not blank, the PDF is not blank.

If you use virtual software such as Pdffactory, Bullzip and other print backgrounds without blank ppt, most PDFs will leave a blank border around the four sides of the PDF.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.