VBA - Excel chart to Powerpoint linked chart

B

Ben

Hi all
Is it possible to add an excel chart to a PowerPoint presentation as a
linked object using VBA (or via an external VB6 app). I want to achieve
the same result as when you copy (to clipboard) a chart from excel and
'Paste Special.../Paste Link' in PowerPoint. I'm using PowerPoint 97 and
Excel 97.

Thanks in advance
Ben
 
B

Brian Reilly, MS MVP

Ben,
PasteSpecial with links is not in the PPT 97 object model.

But there's a tricky workaround that you can use. In Excel, make your
charts either on a chart sheet. Then using VBA code in Excel copy the
worksheet to a new workbook Sheets("MySheet").copy
Then get the color palette from the original workbook if it is a
custom color palette. Then just copy that new single worksheet with a
regular copy command. And paste it into PPT. Then kill that new single
sheet workbook.

The result is that the embedded chart is linked to the original
workbook. Just like pastespecial would work.

Brian Reilly, PowerPoint MVP
 
B

Ben

Hi
I just got around to trying this out and have come accross a few problems.
Firstly, how do I paste into powerpoint from VBA? I have something along
these lines, but it just pastes any text previously in the clipboard...

For Each nextChart In excelWookbook.Charts

nextChart.Copy
ActiveSheet.Copy

Set ppSlide = ppPresentation.Slides.Add(1, ppLayoutBlank)
ppSlide.Shapes.Paste
Next

Also, is it possible to do this with ChartObjects.Charts? Or can I convert
these to WoorkBook.Charts in VBA?

Thanks
Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top