Pasting linked range or chart from Excel to PowerPoint

Dr. Demento

Well-known Member
Joined
Nov 2, 2010
Messages
618
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
I'm having trouble finding an example of the method of pasting a range or chart from Excel into PowerPoint as a linked object. A link would be great.

Thanks y'all.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
The code below (found in the link) worked first time for me
https://www.thesmallman.com/blog/2016/9/16/copy-and-paste-an-excel-chart-into-powerpoint-with-vba

Test (unmodified) like this
- add a chart to the FIRST sheet in your workbook
- place the code below in a module
- In VBA add reference to Microsoft PowerPoint object library (see link for instructions)
- run the code

A new presentation is created with a linked chart in the first slide
After testing it unmodified, then modify code to suit your needs

Code:
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
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top