PDA

View Full Version : Multiple Charts To Multiple Slides



Meerc
06-16-2008, 06:57 AM
Every month I need to create a large report that requires pasting multiple excel charts into multiple slides in PowerPoint. I have an Excel workbook with 25 charts in one worksheet and I need to update an existing presentation with these graphs.

So what I need to do is:

Open an existing presentation and clear the graphs that exist on the slides
Copy the charts in the worksheet one by one and paste them on designated slides in the presentation
Please note:

All the 25 charts will have to be pasted in different slides
It is not the case that chart1 goes to slide1 and chart25 goes to slide25...there is no such order. It is like, chart1 to slide 3, chart2 to slide7, chart3 to slide8 and so on. So, I will need to guide which chart is pasted on which slide.
The new charts will have to be in the same position as the previous charts on the slides.
Most of the slides have one chart only but one slide has two charts.
Can you please tell me how this can be automated using Excel VBA? I really need this urgently so any help is appreciated.Thanks a lot!

Bob Phillips
06-16-2008, 07:01 AM
I have a lot of code that does stuff similar to this, but it is all based upon a single slide PPT template. I would suggest you use the same.

After that, it is just a metter of somehow tagging the charts, and processing them in order (sort the tags?).

Meerc
06-16-2008, 07:09 AM
XLD...thanks for the quick reply.

I have written a code that takes one chart and pastes it to a slide that I designate. Where I am facing a problem is:

How do I create a reference for each chart and map it to every slide number (basically which chart goes to which slide)
How do I pass this entire operation in a loop so that it runs for all charts?Any help will be great!

Thanks!

Bob Phillips
06-16-2008, 07:45 AM
Do a number of things.

- name the charts logically, say Input_Chart, Market_Chart,a nd so on, not using the defaults

- create a list of names in one column, PPT order in the next

- sort this list by PPT order, loop thorugh this list and retrieve the next named chart by name, add a new slide to the PPT presentation, and copy the chart over.

Meerc
06-16-2008, 08:59 AM
Thanks!

I have created the chart names and their corresponding slide destination. But I am not sure about the VBA code to do the looping. Is there any existing code that I can use for this?

Thanks a lot!