Access2003 DB to PowerPoint

G

Guest

I have been able to create a PowerPoint presentation using the following
code, but I would like to include Images in the presentation. The code shows
how to insert the text but I don't understand how to insert images from a
separate field.

Thanks in advance for any help.

Dim db As Database, rs As Recordset
Dim ppObj As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation

'On Error GoTo err_cmdOLEPowerPoint

' Open up a recordset on the Employees table.
Set db = CurrentDb
Set rs = db.OpenRecordset("VideoTable", dbOpenDynaset)

' Open up an instance of Powerpoint.
Set ppObj = New PowerPoint.Application
Set ppPres = ppObj.Presentations.Add

' Setup the set of slides and populate them with data from the
' set of records.
With ppPres
While Not rs.EOF
With .Slides.Add(rs.AbsolutePosition + 1, ppLayoutTitle)
.Shapes(1).TextFrame.TextRange.Text = "Hi! Page " &
rs.AbsolutePosition + 1
.SlideShowTransition.EntryEffect = ppEffectFade
With .Shapes(2).TextFrame.TextRange
.Text = CStr(rs.Fields("QUES").Value)
.Characters.Font.Color.RGB = RGB(255, 0, 255)
.Characters.Font.Shadow = True
End With
.Shapes(1).TextFrame.TextRange.Characters.Font.Size = 50
End With
rs.MoveNext
Wend
End With

' Run the show.
ppPres.SlideShowSettings.Run

Exit Sub

err_cmdOLEPowerPoint:
MsgBox Err.Number & " " & Err.Description
 
S

Steve Rindsberg

I have been able to create a PowerPoint presentation using the following
code, but I would like to include Images in the presentation. The code shows
how to insert the text but I don't understand how to insert images from a
separate field.

It may be as much an Access question as a PPT one, but from the PPT side of
things, you can get images into PPT via the AddPicture method or by using .Paste
on the .Shapes collection of the slide.

AddPicture would require you first to save the image from Access to a file on
disk. I'm guessing you don't want to do that for speed reasons.

If that's correct, the problem becomes "How do you get an image from Access onto
the clipboard so it can be pasted into another app?"
 
B

Brian Reilly, MVP

RAM, Naresh Nichani, an Access MVP did this for my a few years back.
We used the .AddPicture method as Steve suggests. In our database we
had two fields (among many more). One held the file name, e.g.
MyPicture42.jpg and the other held the path to where that was stored
e.g. C:\My Database\Pictures\
Then in your query retrieve both name and path and pass it to PPT.

Brian Reilly, MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top