EdwardAveyard
New Member
- Joined
- Feb 9, 2015
- Messages
- 10
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:
Thanks will go to anyone who can help me with this.
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.