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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can PowerPoint be used as an Output?

Status
Not open for further replies.

Toby1kenobe

Instructor
May 26, 2002
66
0
0
GB

I am designing a database which will produce lots of reports per week. I am wondering whether i can produce Powerpoint slides automatically instead of producing printed sheets. Does powerpoint allow fields like mailmerge does?

Any help is as always greatly appreciated
Toby
 
Hi,

I have not done this personally but I found this in a help file from Microsoft 97. Hopefully, it helps.

Create a Microsoft PowerPoint Presentation

This example demonstrates how to use Automation to create a new Microsoft PowerPoint presentation, insert slides with text and graphics, and then save it.

Sub CreatePresentation()
Dim ppt As PowerPoint.Application
ReDim newSlide(1 To 4) As PowerPoint.Slide
Dim lngHeight As Long
Dim lngWidth As Long
Dim pres As PowerPoint.Presentation
Dim pptShape As PowerPoint.Shape

Dim txtFrame As PowerPoint.TextFrame
Dim i As Integer

'Create the PowerPoint Object
Set ppt = CreateObject("PowerPoint.Application")
Set pres = ppt.Presentations.Add 'Adds a blank presentation
lngHeight = pres.PageSetup.SlideHeight
lngWidth = pres.PageSetup.SlideWidth
For i = 1 To 4
Set newSlide(i) = pres.Slides.Add(i, ppLayoutBlank)

Set txtFrame = newSlide(i).Shapes.AddShape(msoShapeRectangle, _
0, 0, 250, 140).TextFrame
Select Case i
Case 1
Set pptShape = newSlide(i).Shapes.AddPicture _
("c:\Office97\clipart\popular\car.wmf", msoFalse, _
msoTrue, 0, 0, lngWidth, lngHeight)
txtFrame.TextRange.Text = "An Example"
Case 2
Set pptShape = newSlide(i).Shapes.AddPicture _

("c:\Office97\clipart\popular\clock.wmf", _
msoFalse, msoTrue, 0, 0, lngWidth, lngHeight)
txtFrame.TextRange.Text = "Of Automation"
Case 3
Set pptShape = newSlide(i).Shapes.AddPicture _
("c:\Office97\clipart\popular\dice.wmf", _
msoFalse, msoTrue, 0, 0, lngWidth, lngHeight)
txtFrame.TextRange.Text = "With PowerPoint"

Case 4
Set pptShape = newSlide(i).Shapes.AddPicture _
("c:\Office97\clipart\popular\jetplane.wmf", _
msoFalse, msoTrue, 0, 0, lngWidth, lngHeight)
txtFrame.TextRange.Text = "and VBA!"
End Select
pptShape.ZOrder msoSendToBack
With txtFrame.TextRange
.ParagraphFormat.Alignment = ppAlignCenter
.Font.Bold = msoTrue

End With
Next
Pres.SaveAs "c:\My Documents\pptExample1", ppSaveAsPresentation
ppt.Quit 'Close PowerPoint
Set ppt = Nothing 'Clear the object
End Sub

'***********************************************

Have a Great Day!! Please give helpful posts the Stars they deserve. It makes the post more visible for others

Nathan
Senior Test Lead
 
Thanks Nathan!

Can't wait to try this out, looks perfect!

Thanks Again
Toby
 
Nathan,

Exporting queried data to Powerpoint is exactly what I am also trying to do but I am not having any luck with your code. I hate to ASSUME anything so I have to ask is the code you provided compatiable with Access 97, Powerpoint 97? and you mention a help file for Microsoft 97??? Do you have the link information for that help file or can you direct me to that sorce.

Thanks and I would like to hear if Toby had better luck then I did.

Richard
 
Hi Richard,

The help file I posted was taken directly from Office help files that can be d/l from MS. Here is the link:


Good luck and I am very curious if you get this to work. I have yet to try it myself so please let me know if you have some luck with it. Have A Great Day!!!,

Nathan
Senior Test Lead
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top