Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ Microsoft PowerPoint _ Access VBA Add Powerpoint Slide

Posted by: Neondog82 Jun 8 2014, 11:06 AM

Hello all, I'm trying to create a PowerPoint Presentation from Access and I am having trouble with the basics. With the code below, I am able to open PowerPoint, create a new Presentation, but I can't add any slides to it. I get a "Type Mismatch" error on the last line of code for ppLayoutBlank. I tried setting my own CustomLayout but was not successful. I've read throug the MS Developer Reference, but still can't get it. Any help on being able to add a slide to my presentation would be much appreciated.
!--c1-->

CODE
'PowerPoint Variables
Dim PPA As PowerPoint.Application
Dim PPP As PowerPoint.Presentation
Dim PPL As PowerPoint.CustomLayout
'Set PowerPoint Variables
Set PPA = New PowerPoint.Application    'Open PowerPoint
PPA.Visible = msoTrue                   'Show PowerPoint
Set PPP = PPA.Presentations.Add         'Create new presentation
PPP.Slides.AddSlide 1, ppLayoutBlank

Posted by: CyberCow Jun 8 2014, 11:30 AM

NeonDog - see if either of these two links provide any insight . . .
http://msdn.microsoft.com/en-us/library/office/ff746586(v=office.15).aspx
or
http://www.vbaexpress.com/kb/getarticle.php?kb_id=177
hope this helps hat_tip.gif

Posted by: Neondog82 Jun 8 2014, 11:41 AM

Thanks for the help CyberCow. I have already been to both of those sites. I made sure to reference in my origianl post that I looked at the develpers reference already. I am wanting to understand why what I have isn't working.

Posted by: CyberCow Jun 8 2014, 11:59 AM

Do you have a Library Reference checked for the Power Point (and\or Office Objects)?
Admittedly, I've never worked with automation between Access and Power point, so I'm somewhat poking in the dark.

Posted by: zocker Jun 8 2014, 05:32 PM

Oh this automation stuff is always tricky, my suggestion is use the Macro recorder in PPt to do what you would like to do, look at the code in the macro which is written and then copy paste it to your controlling app....I spose there is a macro recorder in 2010?
All the best
zocker