Power Point Print Button or Print Macro

Nutelo
Nutelo used Ask the Experts™
on
Hi,

I would like to know how can I write some code behind button according VBA for print power point document.

thank you
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Jon von der HeydenCourse Leader & Managing Director

Commented:
I think it depends what / how you want to print.  You can write a macro to do the print and then assign it to button in Action Settings.  See example code below. The following instructions assume you are using 2003.
Add the code supplied to a module (CONTROL+F11 > Insert > Module)
Drop a shape onto your slide (AutoShapes > Action Buttons > Custom)
Right click the button > Action Settings > Mouse Click (tab) > Run Macro > MyPrint

Sub MyPrint()
 
With Application.ActivePresentation
    .PrintOptions.PrintHiddenSlides = True
    .PrintOut From:=2, To:=5, Copies:=2, Collate:=msoFalse
End With
 
End Sub

Open in new window

Author

Commented:
It doesn't work. When I run macro there is error occurred. Method 'PrintOut of object'_Presentation' failed
Course Leader & Managing Director
Commented:
Hi
It works for me.  Did you try and amend it for your needs?  It's currently set to rpint slides 2 thru 5 and make 2 copies.  The following worked nicely for me.
1. Add the code to a new module (in PowerPoint CONTROL+F11 > Insert > Module and paste into the code pane)
2. Return the the slide and add th Custom Action Button from the AutoShapes dropdown.
3. Right click the Custom Action button and assign it the MyPrint macro.

Sub MyPrint()
 
With Application.ActivePresentation
    .PrintOptions.PrintHiddenSlides = True
    .PrintOut
End With
 
End Sub

Open in new window

Author

Commented:
Many thanks for Glenna !!!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial