Skip to content

Export data from Access to a PowerPoint Template with named objects


Sub Export2Powerpoint(filePath as string, title as string)

Dim ppApp As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation
Dim ppCurrentSlide As PowerPoint.Slide

Set ppApp = CreateObject("PowerPoint.Application", "")

ppApp.Visible = True

Set ppPres = ppApp.Presentations.Open(filePath) ' filePath is the path to the PowerPoint template file

Set ppCurrentSlide = ppPres.Slides(1)

ppCurrentSlide.Shapes("Title").TextFrame.TextRange.Text = title
ppCurrentSlide.Shapes("MyName").TextFrame.TextRange.Text = "My exported text"

Set ppApp = Nothing
Set ppPres = Nothing
Set ppCurrentSlide = Nothing

    
End Sub

This function writes a string to a named text object in a PowerPoint file. The string written can be generated from a query. Note that you must properly name the objects in you template for this to work.

5
Your rating: None Average: 5 (1 vote)
AdaptiveThemes