0
我有以下副本將傳遞到PowerPoint幻燈片的圖表複製。它用於從Excel電子表格中的圖表和數據構建PowerPoint套牌。此代碼在Excel 2010中工作得很好。我剛剛升級到Office 2013,現在我在sr.LockAspectRatio = msoFalse
行上收到「Object Required」錯誤。升級到Office 2013之後的對象所需的錯誤
Sub Copy_Chart(PPRes As PowerPoint.Presentation, SlideNumber As Integer, Chart As ChartObject, Top As Single, Left As Single, Height As Single, Width As Single)
Dim sr As PowerPoint.ShapeRange
Chart.Activate
ActiveChart.CopyPicture Appearance:=xlScreen, Size:=xlScreen, Format:=xlPicture
Set sr = PPRes.Slides(SlideNumber).Shapes.Paste
sr.LockAspectRatio = msoFalse
sr.Top = Top
sr.Left = Left
sr.Height = Height
sr.Width = Width
End Sub
如果你通過'sr'設置得當嗎? – Raystafarian
我會說不。我可以確認該對象正在粘貼到PowerPoint演示文稿中。所以,我猜測'Paste()'操作不能再返回形狀範圍...... – jradich1234
對於PowerPoint 2013的幫助顯示[Paste method](https://msdn.microsoft.com/EN -US/library/office/ff745532.aspx)返回一個ShapeRange對象 – barrowc