July 27th, 2007

How Can I Configure PowerPoint to Print Handouts Instead of Slides?

Hey, Scripting Guy! Question

Hey, Scripting Guy! How can I configure the print options in PowerPoint so that, by default, handouts are printed rather than slides?

— OG

SpacerHey, Scripting Guy! AnswerScript Center

Hey, OG. You know, whoever said “Lightning never strikes twice in the same place” didn’t reckon on the Scripting Guys, did they? After all, less than a year after winning the Spanish lottery the Scripting Guys have done it again: this time, we’ve won $1 million in the MS-WORD LOTTO LOTTERY!

Thank you; we appreciate that. To tell you the truth, we’re pretty excited about this, too; after all, $1 million is almost as much money as the Scripting Guy who writes this column makes in a year. To get a whole bunch of money for doing absolutely nothing? That’s – well, OK, that’s a reasonably good description of his regular job. But getting a $1 million bonus on top of that is pretty darn nice.

Now, we know what you’re thinking: you’re thinking that this might be some kind of scam or something. That hardly seems possible, however; after all, the email did come from “Microsoft Worldwide Cooperation.” (Which, interestingly enough, marks the first time the words “Microsoft” and “cooperation” have ever occurred in the same sentence.) As if that wasn’t enough, the email includes a security code – MSW/JUN/SS06 – specifically designed to “prevent scam.” Oh, and this: we claim our prize not by contacting some shady, fly-by-night operation in Africa, but by directly contacting Sir Terry Woggan of London, England. (Who, oddly enough, is misidentified in the email as the UK’s Foreign Minister. As everyone knows, Sir Terry is really a radio personality and a commentator for the Eurovision Song Contest. Which makes him way more important than the Foreign Minister.)

Anyway, now being flush with money as well as success, the Scripting Guys are feeling pretty good; in fact, we’d like to share some of our newfound fortune with all of you. By giving away some, or even all, of our $1 million windfall? Heck no; where would you get an idea like that? We have something much more valuable to share with everyone; we have a script that can change the print options in PowerPoint, configuring things so that, by default, handouts (three per page) are printed rather than slides:

Const ppPrintOutputThreeSlideHandouts = 3

Set objPPT = CreateObject(“PowerPoint.Application”) objPPT.Visible = True

Set objPresentation = objPPT.Presentations.Add Set objSlide = objPresentation.Slides.Add(1,1)

Set objOptions = objPresentation.PrintOptions objOptions.OutputType = ppPrintOutputThreeSlideHandouts

To paraphrase the commercial, “Configuring print options in PowerPoint? Priceless.”

As you can see, we start things out by defining a constant (with the delightful name ppPrintOutputThreeSlideHandouts) and assigning it the value 3; we’ll use this constant to tell PowerPoint which print option we’d like to set as the default. That leads to an obvious question: are there other values we could assign as the default print option? Of course there are; in fact, here’s a list of constants and their associated values:

Constant

Value

ppPrintOutputBuildSlides

7

ppPrintOutputFourSlideHandouts

8

ppPrintOutputNineSlideHandouts

9

ppPrintOutputNotesPages

5

ppPrintOutputOneSlideHandouts

10

ppPrintOutputOutline

6

ppPrintOutputSixSlideHandouts

4

ppPrintOutputSlides

1

ppPrintOutputThreeSlideHandouts

3

ppPrintOutputTwoSlideHandout

2

After we define the constant we next create an instance of the PowerPoint.Application object and then set the Visible property to True; that gives us a running instance of PowerPoint that we can see on screen. How exactly do we create an instance of the PowerPoint.Application object and set the Visible property to True? Why, by running these two lines of code, of course:

Set objPPT = CreateObject(“PowerPoint.Application”)
objPPT.Visible = True

In order to change the print options we need a PowerPoint presentation; that’s because the print options are tied to a specific presentation rather than being global options tied to PowerPoint itself. Hence the next two lines of code, in which we create a new presentation (using the default template) and then add a single slide to that presentation:

Set objPresentation = objPPT.Presentations.Add
Set objSlide = objPresentation.Slides.Add(1,1)

Of course, you don’t have to create a new presentation. Alternatively, you can open an existing presentation and change the print options for that presentation. For example, here’s a script that opens the file C:\Scripts\Test.ppt and modifies the print options:

Const ppPrintOutputThreeSlideHandouts = 3

Set objPPT = CreateObject(“PowerPoint.Application”) objPPT.Visible = True

Set objPresentation = objPPT.Presentations.Open(“C:\Scripts\Test.ppt”)

Set objOptions = objPresentation.PrintOptions objOptions.OutputType = ppPrintOutputThreeSlideHandouts

Speaking of modifying print options, that’s what we do next; we create a reference to the PrintOptions object, then assign the constant ppPrintOutputThreeSlideHandouts to the OutputType property:

Set objOptions = objPresentation.PrintOptions
objOptions.OutputType = ppPrintOutputThreeSlideHandouts

That’s all we have to do; if we now click the Print button or programmatically call the PrintOut method we’ll end up with handouts (three per page) rather than slides. Which is exactly what we wanted to end up with.

Note. Are there other print options you can configure besides OutputType? You bet there are; see the Microsoft PowerPoint VBA Language Reference for details.

Anyway, we hope that answers your question, OG. As for the Scripting Guys, once the initial excitement over winning the MS-WORD LOTTO LOTTERY began to fade we started to have second thoughts about this whole thing. After all, Microsoft, of all people, giving money away? Hmmm ….

Author

0 comments

Discussion are closed.