Results 1 to 3 of 3

Thread: Pasting linked range or chart from Excel to PowerPoint
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular Dr. Demento's Avatar
    Join Date
    Nov 2010
    Location
    Skipping stones off Charon's Ferry
    Posts
    546
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Pasting linked range or chart from Excel to PowerPoint

    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.

  2. #2
    Board Regular
    Join Date
    Mar 2015
    Posts
    4,055
    Post Thanks / Like
    Mentioned
    73 Post(s)
    Tagged
    8 Thread(s)

    Default Re: Pasting linked range or chart from Excel to PowerPoint

    The code below (found in the link) worked first time for me
    https://www.thesmallman.com/blog/201...point-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

  3. #3
    Board Regular Dr. Demento's Avatar
    Join Date
    Nov 2010
    Location
    Skipping stones off Charon's Ferry
    Posts
    546
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Pasting linked range or chart from Excel to PowerPoint

    Much appreciated, Yongle. Works for me.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •