问题
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:
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)
来源:https://stackoverflow.com/questions/26782220/paste-excel-range-into-powerpoint-as-table