PDA

View Full Version : Use Access VBA to create an action button in Powerpoint??!



fkneg1
11-26-2013, 02:15 AM
Hi,

I am using VBA in Access 2013 to make a PowerPoint presentation using data from the access database. Does anyone know if it is possible to use Access VBA to create a button in the presentation that runs a procedure itself? I'm not sure how to go about it if it is possible so any help would be appreciated! Thanks.

John Wilson
11-26-2013, 04:03 AM
It would be possible but post the code you have to create the presentation and slide to contain the button. I am presuming the proc is in the PPT presentation?

fkneg1
11-26-2013, 05:08 AM
This is the code I am using to make the powerpoint and create a slide:

Dim db As Database, rs As Recordset
Dim ppObj As PowerPoint.Application
Dim ppPres As Powerpoint.Presentation
Dim pptSlide As Slide
Dim pptLayout As CustomLayout


db = CurrentDb
rs = db.OpenRecordset("*******", dbOpenDynaset)


ppObj = New PowerPoint.Application
ppPres = ppObj.Presentations.Add
With ppPres
.PageSetup.SlideHeight = 540
.PageSetup.SlideWidth = 720
While Not rs.EOF
With .Slides.Add(rs.AbsolutePosition + 1, ppLayoutLargeObject)
.SlideShowTransition.Hidden = msoTrue
.FollowMasterBackground = False
.Background.Fill.Solid()
.Background.Fill.ForeColor.RGB = RGB(0, 0, 0)
With .Shapes(1).TextFrame.TextRange
.Text = "*******"
.Characters.Font.Color.RGB = RGB(255, 255, 255)
.Characters.Font.Size = 36
.ParagraphFormat.Bullet = False
.ParagraphFormat.Alignment = ppAlignCenter
End With
End With
End While
End With

I'm hoping to include the procedure in Access as the presentations are made each time and not saved and all the code is in my Access database. I want to add a button that will set up custom slide shows once the user has made some changes. At the moment I am making the custom slide shows through the VBA in Access and having to edit them manually when slides are added to the presentation by the user.

John Wilson
11-26-2013, 05:40 AM
To the best of my knowledge the action button could ONLY run code in the PowerPoint presentation.

If it was me I think I would put all the code in a PPT AddIn with ribbon buttons to add the presentation from access and then another button to make the custom shows. Not a trivial task but I think more satisfatory.