首页 > 解决方案 > 从 powerpoint 复制内容

问题描述

我可以从 powerpoint 复制内容,但在将其粘贴到另一个 powerpoint 时出现错误。

错误在这一行

pres2.Slides.Paste Index:=pres2.Slides.Count + 1
Dim OutApp As Object
Dim fileNameString As String
Dim NewSlide As Slide
Dim i As Integer
Dim Nstring As String
Dim Nstring1 As String
Dim Allshape As Object

Dim pres1 As PowerPoint.Presentation, pres2 As PowerPoint.Presentation, pp As Object

On Error Resume Next
Set pp = GetObject(, "PowerPoint.Application")
If Err.Number <> 0 Then Set pp = CreateObject("PowerPoint.Application")
On Error GoTo 0

Set pres1 = pp.Presentations.Open(Sheet1.TextBox1.Text)
Set pres2 = pp.Presentations.Open(Sheet1.TextBox2.Text)

Set NewSlide = pres1.Slides(2)
Set Allshape = NewSlide.Shapes
Allshape.Range.Copy
  
pres2.Slides.Paste Index:=pres2.Slides.Count + 1

标签: excelvbapowerpoint

解决方案


推荐阅读