PDA

View Full Version : Automating "Keep Source Formatting & Embed Workbook (K)" Paste Option



Sycdan
08-26-2013, 10:41 AM
I want to copy some Excel charts and paste them into a Powerpoint slide in such a way that the charts appear native to PPT (as opposed to being located on a sheet in an embedded Excel workbook) and have the "Edit Data..." context menu option available when you right click on them. If doing this manually, I can copy the chart in Excel and then Right-Click the target slide and select "Keep Source Formatting & Embed Workbook (K)" from Paste Options, which gives the desired result, however I cannot find a way to automate that particular type of paste.

I have tried:

Application.CommandBars.ExecuteMso "PasteSourceFormatting" -- creates a native chart, but linked as opposed to embedded
ActivePresentation.Slides(1).Shapes.Paste / ActivePresentation.Slides(1).Shapes.PasteSpecial ppPasteDefault -- same as above
ActivePresentation.Slides(1).Shapes.PasteSpecial ppPasteOLEObject,link:=msoFalse -- embeds the workbook object on the slide, putting the chart on a new sheet

None of the above methods end with the scenario I explained above. If anyway has any other ideas, I'd really like to hear them. I am using Office 2010, by the way.

Thanks!

John Wilson
08-26-2013, 12:56 PM
You could try

Application.CommandBars.ExecuteMso "PasteExcelChartDestinationTheme"

OR

Application.CommandBars.ExecuteMso "PasteExcelChartSourceFormatting"

Sycdan
08-26-2013, 01:33 PM
Thank you so much, John! PasteExcelChartSourceFormatting appears to be exactly what I was looking for; I had dome a good bit of trial-and-error with custom mso ID strings, having been unable to find a list of them anywhere, but didn't find anything useful. Do you have, or can you link me to, a full list of ID strings for Office 2010?

Cheers.

John Wilson
08-27-2013, 02:00 AM
I can't remember the link on MSDN but you can get them on our site.


HERE (http://www.pptalchemy.co.uk/Downloads/XMLid.zip)