将 Excel 范围作为表格粘贴到 Powerpoint 中 [英] Paste Excel Range into Powerpoint as Table
问题描述
我正在尝试在 excel 中编写一个宏,以将一系列单元格从 excel 复制到 powerpoint.但是,我似乎无法弄清楚将范围作为表格粘贴到 powerpoint 中的行(例如右键单击并点击粘贴").
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.
我尝试了 Activesheet.shapes.paste 但这给了我关于数据类型的错误
I tried Activesheet.shapes.paste but that gave me an error about data type
我也尝试过 Activesheet.shapes.pastespecial,但据我所知,没有一个选项可以粘贴为表格.我不想粘贴为图片或类似内容.
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.
有什么想法吗?
推荐答案
James - 看看这个:http://www.thespreadsheetguru.com/blog/2014/3/17/copy-paste-an-excel-range-into-powerpoint-with-vba
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)
这篇关于将 Excel 范围作为表格粘贴到 Powerpoint 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!