我有一些代码在excel中获取图表并将其粘贴到powerpoint幻灯片中。但是,一旦将其粘贴到powerpoint中 ,我不确定如何调整图表的大小。我已经研究过它是哪个数字“形状”,我可以手动执行此操作,但我不知道如何自动执行此操作。任何帮助将不胜感激,谢谢!
这是我的代码:
Sub AddChartToPPT(PPT As PowerPoint.Application, Slide As Integer, Chart As String, FromTop As Double, FromLeft As Double, Length As Double, Width As Double)
Dim activeslide As PowerPoint.Slide
PPT.ActiveWindow.View.GotoSlide Slide
Set activeslide = PPT.ActivePresentation.Slides(Slide)
ActiveSheet.ChartObjects(Chart).Activate
ActiveChart.ChartArea.Copy
activeslide.Shapes.PasteSpecial(DataType:=ppPasteMetafilePicture).Select
PPT.ActiveWindow.Selection.ShapeRange.Left = FromLeft
PPT.ActiveWindow.Selection.ShapeRange.Top = FromTop
'Need to add scaling code
End Sub