I have an excel file with some charts and tables and I would like to make a macro that copies these charts and tables from excel to an already existing powerpoint presentation on different slides, any help would be appreciated.
I have an excel file with some charts and tables and I would like to make a macro that copies these charts and tables from excel to an already existing powerpoint presentation on different slides, any help would be appreciated.
You were not very specific in how you wanted everything copied etc, but this should get you started...
To test the code:
- open up a new blank PowerPoint presentation
(ensure that is the only one open!)
- open the attached file
- run the macro with {CTRL} t
- 6 sheets are added to the open presentation
The macro:
- loops through each worksheet
- copies every chart
- pastes to a new slide
- loops through each worksheet
- copies every "Excel Table" (ie those created with Insert\Table)
- pastes to a new slide
- loops through every named range with name beginning "pp_"
- copies that range
- pastes to a new slide
Credit
- this code started with what was found on this Peltier Tech page
The code:
When creating your macro in a different Excel file:Please Login or Register to view this content.
REMEMBER to set VBE reference to Microsoft PowerPoint Object Library
(under VBA menu Tools\References)
VBARef.jpg
Last edited by kev_; 07-21-2017 at 02:25 AM.
Click *Add Reputation to thank those who helped you. Ask if anything is not clear
Thanks but what i really need to know is how to paste a powerpoint already saved down. I dont want to create a new one. Additionally I want to paste to specific slides I dont need to create new ones or use any loops.
Last edited by deanle91; 07-21-2017 at 09:40 AM.
- my VBA does not create a new powerpoint - it merely adds the 6 slides (based on contents of my example workbook) to the active presentation (I told you to open a blank new one to allow you to test what the VBA is doing)I dont want to create a new one
Very simplyI want to paste to specific slides
this line in Excel VBA copies a specific chart named "Chart 2" and which is on sheet "Chart 1"
this line pastes it into slide 3 in the active presentation and selects it so that we can then move it etcPlease Login or Register to view this content.
If you need more help please be specific in your questionsPlease Login or Register to view this content.
Last edited by kev_; 07-21-2017 at 04:29 PM.
Ok thanks
I tried just running this code but I am getting Run-time error '429' ActiveX component cant create object
Please Login or Register to view this content.
Are you writing your code in Excel?
I think your code could not find the active presentation - how were you activating it?
This (tested) code successfully copies "Chart 2" on sheets "English" to slide 15 in the active presentation
Please Login or Register to view this content.
Ok great the new code works now
Is there a way to paste it using the 'destination theme and embedded workbook' instead of picture so it matches the theme of the presentation?
Try this
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks