PDA

View Full Version : [SOLVED] Print all slides in a PPT



s96talle
04-28-2005, 07:24 AM
Hi I am having problem with such an easy thing as printing....

I have placed a textbox in my slide master and that triggers an action that runs a macro so a user can print when they are in slide show mode.

I have succeded to print, but my functions gives me only one page not the complete presentation. :banghead:

Anyone that could give me something on this one?

Thanks!

Daniel

------ some example code-------


Sub PrintPPT()
Dim AppPPT As Object
Set AppPPT = CreateObject("PowerPoint.Application")
AppPPT.Visible = True
' If you want to hide the PowerPoint Window, set the visible property
' to FALSE and WithWindow argument of Open method to FALSE too.
With AppPPT.Presentations.Open("c:\sample.ppt")
DoEvents
' Use .PrintOptions property to specify any additional settings
' Set background printing off else, PowerPoint will terminate before printing is completed.
.PrintOptions.PrintInBackground = False
.PrintOut
.PrintOptions.PrintInBackground = True
End With
AppPPT.Quit
Set AppPPT = Nothing
End Sub

Killian
04-28-2005, 08:14 AM
Hi Daniel and welcome to VBAX :hi:

The PrintOut method takes optional paramaters, so you can define what to print e.g.ActivePresentation.PrintOut From:=2, To:=5, Copies:=2, Collate:=msoFalse

Howard Kaikow
04-28-2005, 08:24 AM
Try



Sub PrintPPT()
Dim AppPPT As Powerpoint.Application
Set AppPPT = new PowerPoint.Application
with AppPPT
.Visible = True
with .Presentations.Open("c:\sample.ppt")
.PrintOptions.PrintInBackground = False
.PrintOut
end with
.Quit
End With
set AppPPT = nothing
End Sub

s96talle
04-28-2005, 11:46 PM
Thanks! But I still can't print it the way I want.... can it be anything strange with the PPT? Must check the printer as well.....

This is strange..... :bug:

s96talle
04-29-2005, 12:15 AM
Hi again, tried with another PPT and it worked! Great.... but what on earth could be wrong with my first PPT?

I see a breakthrough.... coming soon! :thumb

s96talle
04-29-2005, 01:01 AM
Yes!



ActivePresentation.PrintOut From:=1, To:=all, Copies:=1, Collate:=msoFalse

Worked fine..... halleluja!

Thanks again!

Killian
04-29-2005, 01:24 AM
Cool! :thumb

Gald you got it working
(I've marked the thread "Solved")