In the post in the other group, I said that Office-wide (Excel) charts built
in PowerPoint were not accessible to VBA, but that charts made in Excel and
then inserted into PowerPoint were accessible through the familiar OLE
approach. This was only partially true.
If an Excel 2007 chart is copied in Excel and Pasted into PowerPoint, it
behaves as one of the new Office-wide Excel charts. It is inaccessible to
VBA. You can access the shape itself, but there is no OLE Object in it which
you can hook into. They've even added a property, HasChart, to tell you that
the shape contains a chart, but there is no Chart object that you can hook
into. I don't know whether to blame it on a design error or on a lack of
time to implement, but it is a major shortcoming in Office 2007.
There is hope, however. You can insert the chart from a file. Make sure the
workbook is open but saved such that the chart is the active chart sheet,
then use code similar to this to insert it into PowerPoint (this is code
running in Excel VBA):
' insert from excel file
Set ppShape = ppSlide.Shapes.AddOLEObject _
(Left:=90#, Top:=240#, Width:=360#, Height:=240#, _
Filename:=ActiveWorkbook.FullName, Link:=msoFalse)
With ppShape
.Name = "xlInsertedSheet"
.Width = ActiveChart.ChartArea.Width
.Height = ActiveChart.ChartArea.Height
.Left = (ppPres.PageSetup.SlideWidth - .Width) / 2
.Top = (ppPres.PageSetup.SlideHeight - .Height) / 2
End With
Now you can manipulate the chart in the PowerPoint shape named
xlInsertedSheet, using OLE to hook into the chart.
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. -
http://PeltierTech.com
_______
"Bengt" <bobone a pointer.se> wrote in message
news:%(E-Mail Removed)...
> Hi,
>
> I ask a question that must have been asked 100 times about Office 2007:
> - is it 100% true that it is impossible to reach pasted Excel charts in
> PPT programatically. I.e. what whas done before by addressing the
> Activechart of the OLEObject.
>
> This is a nightmare for all code that I have developed that cleanses
> charts pasted in PPT from Excel. I can't understand whay this door has
> been closed?
> Is this forever?
>
> Best regards,
>
> Bob
>
>
>