Excel

TheSmallman.com

an XL ideas Lab

Dashboards VBA
  • Home
  • Dashboards
    • Tips & Tricks
    • Charts
    • Modelling
    • Infographics
    • VBA
  • Shop Dashboards
    • Power Pivot a User Guide
    • Excel Dashboard Course
    • Advanced Dashboard Course
    • Financial Modelling Course
    • Excel VBA Course
  • Blog
  • About
Menu

Excel Dashboards VBA

Street Address
City, State, Zip
Phone Number
an XL ideas Lab

Your Custom Text Here

Excel Dashboards VBA

  • Home
  • Dashboards
  • Excel Tips
    • Tips & Tricks
    • Charts
    • Modelling
    • Infographics
    • VBA
  • Shop Dashboards
  • PowerPivot
    • Power Pivot a User Guide
  • Courses
    • Excel Dashboard Course
    • Advanced Dashboard Course
    • Financial Modelling Course
    • Excel VBA Course
  • Blog
  • About

Copy and Paste an Excel Chart into PowerPoint with VBA

December 22, 2015 Marcus Small

Creating Powerpoint presentations automatically is handy if you want the power to control another office application.  In this post I will copy a chart in Excel and paste it into a fresh instance of Power Point.  I will show two examples, once where the data will be pasted into a presentation with a title and one without.   This is a building blocks approach, creating a procedure which pastes one chart might seem like time better spent done manually but if there were 20 charts it would be faster for VBA to do the work for you.  It could cut down error as well, the more laborious a task the more likely you are to miss a chart or copy the same chart twice.  Excel take the manual part of that process out of the equation and only puts in the charts from a particular sheet or workbook.

One of the things you will need to remember when you commence this task is to create a link to the Powerpoint object library.

On the Tools Menu choose Reference.

Click on the Microsoft Powerpoint xx.0 object library.  Then click OK.

This will allow Excel and Powerpoint to talk to one another.  The following is the coding which will achieve the task.

Option Explicit
Sub CopyChartPP()
   Dim oPPT As Object
   Dim oPres As Object
   Dim oSld As Object
   Dim oWS As Worksheet
   Dim oCHT As ChartObject

   Set oPPT = CreateObject("PowerPoint.Application")
   Set oPres = oPPT.Presentations.Add(msoTrue)
   Set oSld = oPres.Slides.Add(1, ppLayoutTitleOnly)
   Set oWS = ActiveWorkbook.Worksheets(1)
   Set oCHT = oWS.ChartObjects(1)
   oCHT.Select

   ActiveChart.ChartArea.Copy
   oSld.Shapes.PasteSpecial link:=msoTrue
End Sub

In order to put the single chart into a blank  PowerPoint slide change the line above:

Set oSld = oPres.Slides.Add(1, ppLayoutBlank)

I will post a file shortly.

Tags Excel, vba, powerpoint, chart
← Red, Green, Blue Interior Cell ColourAdd Picture to Excel Cell →

Featured Posts

Excel Dashboards: Tracking a Crisis

Excel Dashboards: Tracking a Crisis
April 14, 2020

Recent Posts

Populating an Excel Table from a Range of Cells with VBA

Populating an Excel Table from a Range of Cells with VBA June 12, 2025

Fuzzy Distribution with Randbetween

Fuzzy Distribution with Randbetween May 21, 2025

Add Minimum and Maximum for Chart in Cells

Add Minimum and Maximum for Chart in Cells March 12, 2025

Inflation Over Multiple Years in a Single Cell

Inflation Over Multiple Years in a Single Cell January 10, 2025

Hubspot Dashboard

Hubspot Dashboard October 3, 2024

Monthly Dashboard With Supporting Metrics

Monthly Dashboard With Supporting Metrics September 25, 2024

Excel Show Missing Sheet Tabs

Excel Show Missing Sheet Tabs July 29, 2024

Run Macro Overnight Automatically

Run Macro Overnight Automatically June 24, 2024

Split File into Parts and Save to Directory

Split File into Parts and Save to Directory April 20, 2024

Most Popular Author

Most Popular Author December 14, 2023

 

Follow US:

 
 

MarcusSmall@thesmallman.com

 

TheSmallman.com - Making your small systems hum...
© Copyright 2013-2024 theSmallman.com All Rights Reserved.