+ Reply to Thread
Results 1 to 2 of 2

Copying excel charts into powerpoint slide

  1. #1
    Registered User
    Join Date
    04-22-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    21

    Copying excel charts into powerpoint slide

    Hi All,

    got a bit of a problem with a VBA script i'm trying to run to get a chart to copy across (as an image) into a powerpoint slide. So what it SHOULD do is:

    Run
    Seek chart name ("Rectangle 1")
    Open Powerpoint
    Paste image
    End

    As a basic overview. So far all im getting is Runtime error 9 - subscript out of range. After checking out MSDN.Microsoft it is stating that i have written the parameters outside of boundaries. I honestly cannot see where, is someone able to please see and maybe point out where i have gone wrong?

    `Const ppLayoutBlank = 2
    Const ppViewSlide = 1

    Sub ExportChartstoPowerPoint()
    Dim PPApp As Object
    Dim chr
    Set PPApp = CreateObject("PowerPoint.Application")
    PPApp.Presentations.Add
    PPApp.ActiveWindow.ViewType = ppViewSlide
    For Each chr In Sheets("Rectangle 1").ChartObjects
    PPApp.ActivePresentation.Slides.Add PPApp.ActivePresentation.Slides.Count + 1, ppLayoutBlank
    PPApp.ActiveWindow.View.GotoSlide PPApp.ActivePresentation.Slides.Count
    chr.Select
    ActiveChart.CopyPicture Appearance:=xlScreen, Size:=xlScreen, Format:=xlPicture
    PPApp.ActiveWindow.View.Paste
    PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
    PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True
    Next chr
    PPApp.Visible = True
    End Sub`

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Copying excel charts into powerpoint slide

    I built this as a general utility to add text, ranges and charts from Excel to PowerPoint. You might be able to use it "out of the box" or at least it will show you how some things are done.

    What this tool can do is substitute text it finds on the PowerPoint sheet with text you provide. Copy and place a range (either a fixed range or a dynamic range). Copy and place a chart (or other object).

    The zip file has the tool and a PowerPoint "template" - the template contains the sheets (minus the ranges and charts) and the text to look for and replace. The definitions table tell the program what to do:
    - Excel Page is the page in the excel sheet to copy from - for text substitution, this can be anything
    - Excel Object is the range on the page to copy from. For ranges and charts, it's the name - for text it can be anything
    - Excel type is either Text, Range or Chart.
    - PP Page is the PowerPoint page on which to put the chart or range or on which to substitute the text
    - PP Object is for your own use - it is not used by the program
    - Top, Left, Height, Width are the coordinated (in inches) to place the object on the page - You may have to replace the 72 multiplier in the code for centimeters.
    - Old Text, New Text are used for text substitutions.
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Centering shapes on slide when copying from excel to powerpoint
    By beaks in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-11-2016, 12:06 PM
  2. two excel charts per powerpoint slide
    By stubyh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-09-2013, 11:09 AM
  3. Copy and paste some charts from excel into specific slide on a powerpoint template
    By ones4rus in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-23-2013, 03:00 AM
  4. [SOLVED] Copy Named charts in Excel to specific slide in Powerpoint
    By allstarrunner in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2012, 09:10 AM
  5. [SOLVED] Copying worksheetname to powerpoint slide
    By irfanparbatani in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-30-2012, 01:04 AM
  6. Replies: 0
    Last Post: 12-02-2011, 12:06 PM
  7. selecting group of charts to copy to a powerpoint slide
    By amid in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-10-2009, 03:31 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1