[英]VBA, how to paste word table as picture (enhanced metafile) to a power point?
[英]Excel VBA - Copy a chart and paste as an enhanced metafile
我正在嘗試復制Chart1作為Book1 Sheet1中的對象,並將其粘貼為Book2 Sheet1中的增強圖元文件圖片。 我從其他網站獲得此代碼,但它不起作用:
'Book1 and Book2 previously declared as Workbooks and set
Book1.Sheets(1).ChartObjects(1).CopyPicture
Book2.Sheets(1).Range("B3").Paste
我得到運行時錯誤438:“對象不支持此屬性或方法”
我會使用這樣的東西 ,但是他們的代碼引用了圖表位置,如果可能的話我想按圖表編號。
更新:
我已將代碼修改為以下內容:
'Sheet1 and Sheet2 declared and set as Worksheets
Sheet1.ChartObjects(1).Chart.CopyPicture
Sheet2.PasteSpecial Format:="Picture (Enhanced Metafile)", _
Link:=False, DisplayAsIcon:=False
With Sheet2.Shapes(Sheet2.Shapes.Count)
.Top = Sheet2.Range("B3").Top
.Left = Sheet2.Range("B3").Left
End With
但它現在返回運行時錯誤1004:“對象'_Worksheet'的方法'PasteSpecial'失敗”。
例如:
Sheet1.ChartObjects(1).CopyPicture
Sheet1.PasteSpecial _
Format:="Picture (Enhanced Metafile)", _
Link:=False, DisplayAsIcon:=False
With Sheet1.Shapes(Sheet1.Shapes.Count)
.Top = Sheet1.Range("B3").Top
.Left = Sheet1.Range("B3").Left
End With
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.