VBA: putting a series of graphs from Excel into PowerPoint
Results 1 to 3 of 3

Thread: VBA: putting a series of graphs from Excel into PowerPoint
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Feb 2015
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default VBA: putting a series of graphs from Excel into PowerPoint

    I created a spreadsheet with a drop-down that changed the data on display in the graph for the selection. I've been asked to create a powerpoint pack that shows each of these graphs on a different slide.

    There are 35 options in the drop-down. There are actually two graphs for each option. The end product should have 35 slides (excluding the title slide) each with two graphs on.

    I can work out the bits solely in Excel but not the bits in PowerPoint.

    Excel bits
    Going through the 35 options
    For i = 1 To 35


    'Cell A1 on Sheet1 has the value fixed to the drop-down. Changing this changes the graphs. The drop-down is also set to run the macro TissueSelection each time.
    Sheet1.Cells(1, 1).Value = i
    Call TissueSelection

    '(after all the rest of the code that I don't know yet)
    Next i

    Copying the graphs (this would go somewhere in between Call TissueSelection and Next i, but I'm not sure where as I can't work out the other PowerPoint bits
    ActiveSheet.ChartObjects("Chart 3").Activate
    ActiveChart.ChartArea.Copy

    ActiveSheet.ChartObjects("Chart 4").Activate
    ActiveChart.ChartArea.Copy



    Where I'm stuck: how to interact with PowerPoint
    I have tried a few things online but none of them works. I need to open an existing PowerPoint file, add in a new slide each time and then paste the two graphs on that new slide, before then doing the next i.

    This one fails on Set PPApp = GetObject("Powerpoint.Application"). I get run-time error 424 "Object required".
    This one fails on Slidecount = PPPres.Slides.Count with error 424 again.

    I'm wondering if I need to have another reference library ticked. This is what I have on currently:
    • Visual Basic for Applications
    • Microsoft Excel 16.0 Object Library
    • OLE Automation
    • Microsoft Office 16.0 Object Library
    • Microsoft SQL Server PowerPivot for Microsoft Excel


    Thanks will go to anyone who can help me with this.

  2. #2
    Moderator mole999's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    9,830
    Post Thanks / Like
    Mentioned
    16 Post(s)
    Tagged
    2 Thread(s)

    Default Re: VBA: putting a series of graphs from Excel into PowerPoint

    if you haven't discovered it,. break every link. i did loads, then updated and had one graph the same on every slide
    • Yes I know there are better ways to do it. I just wish I knew them. - 97, 2003, 2007, 2010, 2013, 2016 & 2019
    • I wear my ignorance openly, excel is not my chosen career, its a means to an ends
    • Posting Guidelines Want to post well laid out questions and answers Translate Excel Versions
      Code:
      [CODE ]Put Your Code[/ CODE]
    • Settings > General Settings (on the left) scroll to the bottom, > Miscellaneous Options > Use ENHANCED
    • X-Posting Guidelines Rule 13 > CHART STUFF

  3. #3
    New Member
    Join Date
    Feb 2015
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA: putting a series of graphs from Excel into PowerPoint

    Quote Originally Posted by mole999 View Post
    if you haven't discovered it,. break every link. i did loads, then updated and had one graph the same on every slide
    Thanks for your response, mole999.

    I managed to adapt the code here and get something workable.

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
  •