fkneg1
07-19-2023, 11:43 PM
Hi,
I have an Access database with VBA that produces a PowerPoint presentation based on the chosen fields of the database. One feature of this database I would like to do is to be able to insert other PowerPoint presentations into the new presentation. I have been able to do this so far with:
.Slides.InsertFromFile _
FileName:=(rs.Fields("Extra slides 1")), Index:=0
but this does not keep the source formatting of the slides. Looking around I found that I could copy and paste the slides in instead using code like this:
Dim objPresentation As Presentation
Dim intobj As Integer
Set objPresentation = Presentations.Open("C:\123.pptx", , msoFalse) 'Error on this line
For intobj = 1 To objPresentation.Slides.Count
objPresentation.Slides.Item(intobj).Copy
Presentations.Item(1).Slides.Paste
Presentations.Item(1).Slides.Item(Presentations.Item(1).Slides.Count).Desig n = _
objPresentation.Slides.Item(intobj).Design
Next intobj
objPresentation.Close
But this is not working - I am getting error code '2147221164 Class not registered' on the line indicated and the slides are not copying in. My guess is that as the code is all running in Access to generate the presentation it doesn't know where to paste the new slides?? Any ideas?
Thanks!
I have an Access database with VBA that produces a PowerPoint presentation based on the chosen fields of the database. One feature of this database I would like to do is to be able to insert other PowerPoint presentations into the new presentation. I have been able to do this so far with:
.Slides.InsertFromFile _
FileName:=(rs.Fields("Extra slides 1")), Index:=0
but this does not keep the source formatting of the slides. Looking around I found that I could copy and paste the slides in instead using code like this:
Dim objPresentation As Presentation
Dim intobj As Integer
Set objPresentation = Presentations.Open("C:\123.pptx", , msoFalse) 'Error on this line
For intobj = 1 To objPresentation.Slides.Count
objPresentation.Slides.Item(intobj).Copy
Presentations.Item(1).Slides.Paste
Presentations.Item(1).Slides.Item(Presentations.Item(1).Slides.Count).Desig n = _
objPresentation.Slides.Item(intobj).Design
Next intobj
objPresentation.Close
But this is not working - I am getting error code '2147221164 Class not registered' on the line indicated and the slides are not copying in. My guess is that as the code is all running in Access to generate the presentation it doesn't know where to paste the new slides?? Any ideas?
Thanks!