复制Excel表格粘贴到特定的PPT幻灯片
详情:Mac Excel(2016)复制到Mac PPT(2016)
最后,我想循环遍历所有表格,并在PPT中将每个表格粘贴到它自己的幻灯片中。
但首先我试图从Excel中复制一个表格并粘贴到特定的PPT文件(而不是networking新的演示文稿)。
Sub OpenPPTandCopySelectedTable() Dim PPT As PowerPoint.Application Set PPT = New PowerPoint.Application PPT.Visible = True 'Open the specific Template PPT.Presentations.Open Filename:="/Users/MyNameHere/Downloads/FileName.pptx" 'Make Specific File the Active Presentation Set PPPres = PPT.ActivePresentation 'Copy the Excel Table Range("Table1[#All]").Copy 'Select PowerPoint Slide number 2 PPT.Slides(2).Select 'Paste Special Application.ActiveWindow.View.PasteSpecial DataType:=ppPastePNG End Sub
我究竟做错了什么? 任何帮助,将不胜感激。
尝试下面的代码(不使用Select
和ActivePresentation
,这会减慢代码的运行时间)。
Option Explicit Sub OpenPPTandCopySelectedTable() Dim PPT As PowerPoint.Application Dim PPPres As PowerPoint.Presentation Dim myShape As Object Set PPT = New PowerPoint.Application ' Open the specific Template and set it (in 1 line) Set PPPres = PPT.Presentations.Open(Filename:="/Users/MyNameHere/Downloads/FileName.pptx", ReadOnly:=msoFalse) 'Copy the Excel Table Range("Table1[#All]").Copy ' Paste to PowerPoint and set to MyShape 'Set myShape = PPPres.Slides(2).Shapes.PasteSpecial(ppPastePNG, msoFalse) ' if you want to edit the properties 'With myShape '.Left = '.Top = 'End With ' Option 2: PPPres.Slides(2).Shapes.PasteSpecial (ppPastePNG) End Sub
- Excel VBA:如果某个值存在于同一列中,则将一个单元格的值存储在variables中
- 如何将今天的date与Exceldate列进行比较,以便在C#中显示当前input的数据
- 如何从第3行开始select整个列 – vba
- 在Excel中,在查找值集合上执行查找function
- Excelmacros代码连接到一个FTPS服务器,即FTP通过SSL而不是FTP服务器
- Excel :: Writer :: XLSX写一个公式,打开这个excel文件,并用一个警告对话框closures它
- 在Excel中从总小时数和分钟数中扣除
- 在Excel 2007中用VBA写一个总和公式(= t1 + t2 + tN)
- Excel交叉过滤时崩溃