删除子数据表
我有一个powerpoint presentation
,其中diagrams
的数据在subdatasheet
(当您双击图表时打开的图表)。
现在,我想将presentation
发送给客户,而无需更改数据datasheet
中的datasheet
但可以使用animations
。
所以只是从diagram
提出一个图片是不行的。
我试图删除linkings
但没有奏效。 任何人都知道我可以做到这一点的vba
?
编辑:根据R3uK's answer
我试过了:
Sub Export_to_Ppt() Dim myChart As PowerPoint.Chart Set myChart = ActivePresentation.Slides(1).Shapes("Diagramm 1").Chart myChart.ChartArea.Copy ActivePresentation.Slides(ActivePresentation.Slides.Count).Shapes.PasteSpecial ppPasteEnhancedMetafile End Sub
这是工作,但对我来说,看起来像我得到一个不可思议的图片。
我使用这个基地导出我的图表PPT作为Officegraphics( ppPasteEnhancedMetafile
):
Sub Export_to_Ppt() ' Dim Ppt As PowerPoint.Application, _ Pres As PowerPoint.Presentation Set Ppt = CreateObject("PowerPoint.Application") Set Pres = Ppt.Presentations.Open("C:\Template.potx") Ppt.Visible = True Sheets("SubDataSheet").ActiveChart.ChartArea.Copy Pres.Slides.Add Index:=Pres.Slides.Count + 1, Layout:=ppLayoutTitleOnly Pres.Slides(Pres.Slides.Count).Shapes.PasteSpecial ppPasteEnhancedMetafile Pres.Slides(Pres.Slides.Count).Shapes.Title.TextFrame.TextRange.Text = "Chart Title" Pres.SaveAs _ Filename:="C:\OutPut_PPT.ppt", _ FileFormat:=ppSaveAsOpenXMLPresentation Set Ppt = Nothing Set Pres = Nothing End Sub