Log in

View Full Version : Copy -> Paste slides between two presentations error



someusersend
09-22-2016, 04:02 AM
Hello everyone,

I am facing some problem with clipboard while copying slides from one (template) presentation to another (result presentation). I am copying them in loop and doing some other stuff, like updating data/texts on them.
But the problem keeps going back in the part of code below (exactly while pasting):


Function copyTemplateSlide(templateSlide As PowerPoint.slide, resultPpt As PowerPoint.Presentation) As PowerPoint.slide
With resultPpt
If .Windows.count > 0 Then
.Windows(1).selection.Unselect
End If
Call clearClipboard
Call templateSlide.copy
Call .Slides.paste(.Slides.count + 1)
Set copyTemplateSlide = .Slides(.Slides.count)
End With
End Function

Error:
17137

alternatively to this Slides.paste method I have tried to use method of View object but with no luck either:

resultPpt.Windows(1).View.PasteSpecial dataType:=ppPasteDefault



I also tried clearing the clipboard before copying the slide, but with no positive result either (clearClipboard SUB).

Does anybody have come up with such a problem? Any ideas on possible reasons and how to resolve it?

Thank you in advance,
Piotr