Macro that copies charts from a worksheet in excel to different slides in Power Point

Posted on 2014-07-17
Last Modified: 2014-07-17
i have a number of charts on a worksheet, i want to create a macro that copies each of the charts into a separate slide in powerpoint. Thank you!
Question by:gprempeh
    LVL 13

    Expert Comment

    There is example tutorial to let you to paste the active excel chart into the Active PowerPoint Slide at

    Hope understand your question completely.If not , please pt it out
    LVL 23

    Accepted Solution

    This would be the basic code (Late bound) You may need to improve it to suit your needs.

    If the charts are not directly on the sheets but have been moved to chart sheets the code would be different.

    Sub pptpaster()
    Const ppLayoutTitleOnly = 11
    Dim i As Integer
    'does not require reference to PowerPoint
    Dim pptapp As Object
    Dim pptPres As Object
    Dim pptsld As Object
    Dim s As Integer
    Dim ocht As Object
    Set pptapp = CreateObject("PowerPoint.Application")
    pptapp.Visible = True
    Set pptPres = pptapp.Presentations.Add
    For s = 1 To ActiveWorkbook.Sheets.Count
    For i = 1 To Sheets(s).ChartObjects.Count
    Set pptsld = pptPres.Slides.Add(pptPres.Slides.Count + 1, ppLayoutTitleOnly)
    Set ocht = pptsld.Shapes.Paste(1)
    ocht.Left = 100
    ocht.Top = 200
    End Sub

    Open in new window


    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Outline From PowerPoint 2010 it is possible to have shapes appear in front of video, in earlier versions video always played in front of other shapes. This means it is possible to have captions animated to appear in front of video. Users who h…
    Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
    The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
    This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now