Paste Excel Range into Powerpoint as Table

2019-09-03 07:23发布

I am trying to write get write a macro in excel to copy a range of cells from excel to powerpoint. However, I can't seem to figure out the line to paste the range into powerpoint as a table (like right clicking and hitting 'paste') in powerpoint.

I tried Activesheet.shapes.paste but that gave me an error about data type

I also tried Activesheet.shapes.pastespecial, but none of the options are for pasting as a table as far as I can tell. I do not want to paste as a picture or anything like that.

Any ideas?

1条回答
倾城 Initia
2楼-- · 2019-09-03 08:13

James - check this out: http://www.thespreadsheetguru.com/blog/2014/3/17/copy-paste-an-excel-range-into-powerpoint-with-vba

It looks like the relevant code snippet from this post is the following:

'Copy Range from Excel
  Set rng = ThisWorkbook.ActiveSheet.Range("A1:D12")

'Copy Excel Range
 rng.Copy

'Paste to PowerPoint and position
 mySlide.Shapes.PasteSpecial DataType:=ppPasteEnhancedMetafile
 Set myShapeRange = mySlide.Shapes(mySlide.Shapes.Count)
查看更多
登录 后发表回答