Power Point Print Button or Print Macro

Hi,

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

thank you
NuteloAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jon von der HeydenCourse Leader & Managing DirectorCommented:
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

0
NuteloAuthor Commented:
It doesn't work. When I run macro there is error occurred. Method 'PrintOut of object'_Presentation' failed
0
Jon von der HeydenCourse Leader & Managing DirectorCommented:
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

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NuteloAuthor Commented:
Many thanks for Glenna !!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft PowerPoint

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.