What you need to do is invoke the PasteSpecial "Keep Source Formatting and Embed Workbook".
Assume you have already created the charts, and the slides, placeholders/etc., and you have already copied the chart and navigated to the destination slide, and that you have an object like PPTApp
to represent the PowerPoint.Application
object.
Instead of using the Shapes.PasteSpecial
method, you can do this:
PPTApp.CommandBars.ExecuteMso "PasteExcelChartSourceFormatting"
This does not create a link to the Excel document, it embeds a local copy of the document in the PowerPoint Presentation. I think I understand this is your requirement.
Update from comments
Documentation on the ExecuteMso
method:
http://msdn.microsoft.com/en-us/library/office/ff862419.aspx
Downloadable document containing the idMSO
parameters for each Office Application:
http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=6627
NOTE: If you want to do something with the pasted chart after .ExecuteMso
you may need to check if the shape is already pasted because .ExcecuteMso
is asynchronous (the macro doesn't know when it's finished). Another question shows you how to wait for its completion .
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…