Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print PowerPoint

Status
Not open for further replies.

ryan1

Programmer
May 15, 2002
106
US
Does anybody know how to automate printing A PowerPoint slide show from access.
 
[idea] Most OLE automation code looks pretty much the same. Here's a simple routine:

Public Function PrintPowerPoint(ByVal strPath As String) As Boolean
On Error GoTo ErrHandler

Dim ppt As PowerPoint.Application
Dim pres As PowerPoint.Presentation
Dim lngCtr As Long

' Create the app.
Set ppt = New PowerPoint.Application

' Open the presentation.
Set pres = ppt.Presentations.Open(strPath, True, True, False)

' print it.
pres.PrintOut From:=1, To:=1, Copies:=1

' set status text.
SysCmd acSysCmdSetStatus, "Printing " & pres.Name & ", please wait..."

' allow time for print.
While lngCtr < 10000
lngCtr = lngCtr + 1
DoEvents
Wend

' close the presentation.
pres.Close

' shut down the app.
ppt.Quit

' Success
PrintPowerPoint = True

ExitHere:
' dereference
Set pres = Nothing
Set ppt = Nothing

Exit Function
ErrHandler:
Debug.Print Err & &quot; - &quot; & Err.Description
Resume ExitHere
End Function


The .PrintOut method can be used without any arguments to print the entire presentation.

Don't forget to reference the Powerpoint library by clicking 'Tools -> References' from within the VB editor and checking 'Microsoft PowerPoint 9.0 Object Library' or whatever version you're using.

Good Luck,
VBSlammer
redinvader3walking.gif
 
Thanks for the help. Works Great!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top