Access to Powerpoint Automation. Unable to create a slide

thechazm

VBA, VB.net, C#, Java
Local time
Today, 01:06
Joined
Mar 7, 2011
Messages
515
Hello all,

I have been doing research for a while now and while there seems to be plenty of information on how to create a power point slide from access 2003 or earlier, I can't seem to find any reference for Access 2007.

The difference is how the slide is created between the two versions and I can't seem to nail down what I am doing wrong. It error's out with a 424 error code during trying to create the slide. If anyone can offer any guidance I would greatly appreciate it.

Code:
Function testppt()
Dim ppApp As PowerPoint.Application, ppPres As PowerPoint.Presentation, i As Long, qry As QueryDef, ppSlide As PowerPoint.Slide
i = 1
Set ppApp = New PowerPoint.Application
Set ppPres = ppApp.Presentations.Add
ppPres.Slides.AddSlide 1, pptlayout
'    With .Slides.AddSlide(1, pptLayout) = "test"
    For Each qry In CurrentData.AllQueries
    
        ppPres.Slides(1).Shapes.AddShape(msoShapeRectangle, 1, i + 10, Len(qry.Name), 30) = qry.Name
    
    Next qry
'    End With
'End With
ppApp.Visible = msoTrue
            
End Function
 
I found the issue. The issue stems from intellisense not showing the .add function. By default I selected what intellisense told me was available .addslides but this function does not operate in the correct mannor to create a new slide.

By adjusting:

Code:
With .Slides.AddSlide(1, pptLayout) = "test"

To

Code:
ppPres.Slides.Add 1, ppLayoutBlank

It works correctly. Just wanted to post this in case someone else run's across this issue.

Thanks,

TheChazm
 

Users who are viewing this thread

Back
Top Bottom