Copy Charts from Excel to PowerPoint Automatically

How to copy Excel charts to PowerPoint automatically using VBA.

Watch the video below:

Automatically Copy Charts from Excel to PowerPoint

When creating PowerPoint presentations and making them more useful, we may need many charts from Excel. We can bring these charts from our Excel workbooks to PowerPoint presentation quickly and easily using Visual Basic for Applications (VBA).

Below is the complete VBA code to automate the process of getting charts from Excel into our PowerPoint slides:

Option Explicit

Sub copyexcelchartstopowerpoint()
‘we first set reference to the MS PowerPoint Object Library

Dim PP As PowerPoint.Application
Dim PPPresentation As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
Dim ppSlideCount As Long, SlideCount As Long
Dim i As Long

Sheets(“SalesOrders”).Select
If ActiveSheet.ChartObjects.Count < 1 Then
MsgBox “No charts found!”
Exit Sub
End If

Set PP = New PowerPoint.Application
Set PPPresentation = PP.Presentations.Add
PP.Visible = msoTrue

For i = 1 To ActiveSheet.ChartObjects.Count
ActiveSheet.ChartObjects(i).Chart.CopyPicture Size:=xlScreen, Format:=xlPicture
Application.Wait (Now + TimeValue(“00:00:01”))
ppSlideCount = PPPresentation.Slides.Count
Set PPSlide = PPPresentation.Slides.Add(SlideCount + 1, ppLayoutBlank)
PPSlide.Select
PPSlide.Shapes.Paste.Select
PP.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, msoCTrue

Next i

‘cleanup memory
Set PPSlide = Nothing
Set PPPresentation = Nothing
Set PP = Nothing

End Sub

Copy Excel Charts to PowerPoint Automatically Using VBA
Copy Excel Charts to PowerPoint Automatically Using VBA

Further Reading

Copy Chart from Excel to PowerPoint Using VBA