'How to automate slide creation from an Excel file?
Quick question on slide automation in Excel / PowerPoint.
Here is the setup:
- Every month, I need to fill a PowerPoint
- In it, I have 5 slides per country, for 30 countries. On each slide, there is from 1 to 3 charts
- I use data from a pivot table in Excel to populate those charts and would like to automate the process
What I have already done:
- The automation in VBA to extract data from the Pivot Table has been done, everything is fine on this side
What needs to be done:
- Copy/paste the data from the Excel file inside the corresponding chart in the PowerPoint
What I was thinking to do, either:
- Copy paste the data directly into the chart, but is it even possible?
- Create a chart in the Excel file and copy paste it into PowerPoint (it cannot be a picture, the data behind the chart has to be accessible)
What do you think is the easiest way to do this?
EDIT: I am on Mac, did not know VBA / Office would be different but it is...
Solution 1:[1]
I would go for the second option.
Since you have performed already the automation for the pivot table, this may lead you to write what you want for.
Note: as commented, you'd need to add a reference for Microsoft Power Point in order to be available to use the following:
Dim PPInstance As PowerPoint.Application
Dim PPSlide As PowerPoint.Slide
Dim SlideShow As PowerPoint.Presentation
For Each SlideShow In PPInstance.Presentations
On Error GoTo Err01PowerPoint_Select
Set PPInstance = GetObject(, "Powerpoint.Application")
If SlideShow.Name = "DesiredValue" Then '1. If SlideShow.Name = "DesiredValue"
For Each PPSlide In SlideShow.Slides
' paste and select the chart picture
ActiveSheet.ChartObjects(YourChartObjectInExcel).Copy
Application.Wait Now + TimeValue("00:00:01")
'It may lost itself
.Shapes.Paste
Application.CutCopyMode = False
'align the chart
'you can definetly align and set the size you desire for the chart in PP, however, I didn't manage to make it work, you may want to search for it
'PPInstance.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
'PPInstance.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True
Next PPSlide
Exit For
Next SlideShow
If 1 = 2 Then '99.if error
Err01PowerPoint_Select:
MsgBox "No Powerpoint presentations are opened!", vbCritical
End If '99.if error
Solution 2:[2]
You are wanting to automate between MS Office applications, Excel and Powerpoint. Microsoft uses the term programatically so a Web search for Programatically excel to powerpoint should get you started. You might add VBA to the search.
Solution 3:[3]
Try this
In excel copy the cells you want in your presentation
Go back to power point and make a "past special" (home tab> past drop down> past special or
Cntrl+Alt+V).
this should insert a linked table into your slide
When you want to update
Go to: file> info
And choose
from the bottom right
Next do this
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sgdva |
| Solution 2 | Ronnie Royston |
| Solution 3 | Zoe stands with Ukraine |



