Hello,
I am using access 2013 to make a PowerPoint presentation based on the data in a query. I know how to do that much using VBA but I am also trying to make a slide with a picture on it from a saved location. I have tried various things without any luck. This is my VBA code:
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 table.
Set db = CurrentDb
Set rs = db.OpenRecordset("All chosen songs", 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, ppLayoutLargeObject)
.Shapes.AddPicture(FileName:="D\Desktop\JDJ\ECC\PowerPoints\ECC logo.jpg").Select
End With
With .Slides.Add(rs.AbsolutePosition + 1, ppLayoutTitle)
End With
rs.MoveNext
Wend
End With
' Run the show.
ppPres.SlideShowSettings.Run
Exit Sub
err_cmdOLEPowerPoint:
MsgBox Err.Number & " " & Err.Description
End Sub
At the moment I am not worrying about adding the data as I know how to do this and had it working before - its just adding the picture to the slide. Any help appreciated!
I am using access 2013 to make a PowerPoint presentation based on the data in a query. I know how to do that much using VBA but I am also trying to make a slide with a picture on it from a saved location. I have tried various things without any luck. This is my VBA code:
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 table.
Set db = CurrentDb
Set rs = db.OpenRecordset("All chosen songs", 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, ppLayoutLargeObject)
.Shapes.AddPicture(FileName:="D\Desktop\JDJ\ECC\PowerPoints\ECC logo.jpg").Select
End With
With .Slides.Add(rs.AbsolutePosition + 1, ppLayoutTitle)
End With
rs.MoveNext
Wend
End With
' Run the show.
ppPres.SlideShowSettings.Run
Exit Sub
err_cmdOLEPowerPoint:
MsgBox Err.Number & " " & Err.Description
End Sub
At the moment I am not worrying about adding the data as I know how to do this and had it working before - its just adding the picture to the slide. Any help appreciated!