X
XStream
We are using some vb code to copy slides from one power point presentation to
another. The code is working properly with the previous office versions
(2007, XP etc). But, for office 2010 the code to paste slide to the
destination presentation is not working. It shows an error message:
"Run-time error '-2147417851 (80010105)':
Method 'Paste' of object 'Slides' failed"
Please find attached PowerPoint2010-Error.JPG also.
Code used to copy and paste the slides is as follows:
Dim oSource As Presentation
Dim oTarget As Presentation
Dim oSlide As Slide
Dim pSlide As Slide
Dim insertposition As Integer
Set PPTApp = CreateObject("PowerPoint.Application")
With PPTApp
.Visible = True
Set oTarget = PPTApp.Presentations.Open(FileName:="D:\\PPT\\Dest.ppt",
WithWindow:=msoFalse)
Set oSource = PPTApp.Presentations.Open(FileName:="D:\\PPT\\Source.ppt",
WithWindow:=msoFalse)
insertposition = 1
For Each oSlide In oSource.Slides
oSlide.Copy
With oTarget.Slides.Paste(insertposition) ‘ error occured
.Design = oSlide.Design
.ColorScheme = oSlide.ColorScheme
insertposition = insertposition + 1
End With
Next oSlide
oSource.Close
oTarget.Save
oTarget.Close
Set oSource = Nothing
End With
another. The code is working properly with the previous office versions
(2007, XP etc). But, for office 2010 the code to paste slide to the
destination presentation is not working. It shows an error message:
"Run-time error '-2147417851 (80010105)':
Method 'Paste' of object 'Slides' failed"
Please find attached PowerPoint2010-Error.JPG also.
Code used to copy and paste the slides is as follows:
Dim oSource As Presentation
Dim oTarget As Presentation
Dim oSlide As Slide
Dim pSlide As Slide
Dim insertposition As Integer
Set PPTApp = CreateObject("PowerPoint.Application")
With PPTApp
.Visible = True
Set oTarget = PPTApp.Presentations.Open(FileName:="D:\\PPT\\Dest.ppt",
WithWindow:=msoFalse)
Set oSource = PPTApp.Presentations.Open(FileName:="D:\\PPT\\Source.ppt",
WithWindow:=msoFalse)
insertposition = 1
For Each oSlide In oSource.Slides
oSlide.Copy
With oTarget.Slides.Paste(insertposition) ‘ error occured
.Design = oSlide.Design
.ColorScheme = oSlide.ColorScheme
insertposition = insertposition + 1
End With
Next oSlide
oSource.Close
oTarget.Save
oTarget.Close
Set oSource = Nothing
End With