PDA

View Full Version : Copy Chart from Excel to Powerpoint



scott56
08-11-2010, 01:56 PM
Hi,

I have been trying to achieve a VBA version of a manual process when copying a chart from Excel to Powerpoint.

The manual process works by selecting a chart in Excel, copying that chart into Powerpoint. Selected Paste Special in Powerpoint and then Paste Link of the Excel Chart Object. When it is pasted this way in Powerpoint you are able to edit and modify the chart while the link is in place. When the link is broken the Chart becomes a picture that cannot have it's chart type modified.

In the code snippet below the copy that I perform with VBA does copy the chart across to the powerpoint file as a chart object with a link. But when the links are broken the copied chart in Powerpoint remains a chart object that can be modified and is not a picture.

In the final version of this I want to remove the possibility of changing the chart type so that the released powerpoint looks the same

myWorkbook.Sheets(1).Select

'Copy as a picture but does not have a transparent background
'myWorkbook.ActiveChart.CopyPicture Appearance:=xlScreen, Size:=xlScreen, Format:=xlPicture
'pptSlide.Shapes.Paste.Select

'Copy as a chart but must have a link included that needs to be broken later
myWorkbook.ActiveChart.ChartArea.Copy
pptSlide.Shapes.PasteSpecial(ppPasteDefault).Select


I have attached a word document that describes the manual process.

Any help appreciated...

scott56
08-11-2010, 02:02 PM
Hi,

I have been trying to achieve a VBA version of a manual process when copying a chart from Excel to Powerpoint.

The manual process works by selecting a chart in Excel, copying that chart into Powerpoint. Selected Paste Special in Powerpoint and then Paste Link of the Excel Chart Object. When it is pasted this way in Powerpoint you are able to edit and modify the chart while the link is in place. When the link is broken the Chart becomes a picture that cannot have it's chart type modified.

In the code snippet below the copy that I perform with VBA does copy the chart across to the powerpoint file as a chart object with a link. But when the links are broken the copied chart in Powerpoint remains a chart object that can be modified and is not a picture.

In the final version of this I want to remove the possibility of changing the chart type so that the released powerpoint looks the same

myWorkbook.Sheets(1).Select

'Copy as a picture but does not have a transparent background
'myWorkbook.ActiveChart.CopyPicture Appearance:=xlScreen, Size:=xlScreen, Format:=xlPicture
'pptSlide.Shapes.Paste.Select

'Copy as a chart but must have a link included that needs to be broken later
myWorkbook.ActiveChart.ChartArea.Copy
pptSlide.Shapes.PasteSpecial(ppPasteDefault).Select


I have attached a word document that describes the manual process.

Any help appreciated...

File is attached now.....

Paul_Hossler
08-11-2010, 03:31 PM
You could start with this. It copies an Excel chart as picture, and just pastes it -- still as a picture -- to another sheet, but pasting it to PowerPoint is the same


Sub Macro1()
ActiveSheet.ChartObjects("Chart 1").CopyPicture
Worksheets("Sheet2").Select
Range("C3").Select
Worksheets("Sheet2").Paste
End Sub


Paul

scott56
08-11-2010, 03:46 PM
Paul,
Unfortunately I do need to initially copy the chart as a chart object into the Powerpoint presentation as in some cases modification of the chart is needed while in the presentation....so the copy picture is no good for that.

I did also notice that when copying as a picture into powerpoint the chart background was not transparent as is the case with a chart object. This is important for the presentation....is there anyway to copy a picture into powerpoint with a transparent background around the chart itself

Scott