I work with Delphi (2010), but I'm new to PowerPoint (2010)
I found two codes for copying slides with "keep original formatting":
Sub test1() Dim orig_slide, new_slide As Slide Dim slide_range As SlideRange Set orig_slide = ActivePresentation.Slides(2) orig_slide.Copy Set slide_range = ActivePresentation.Slides.Paste(6) Set new_slide = slide_range.Item(1) new_slide.Design = orig_slide.Design new_slide.ColorScheme = orig_slide.ColorScheme End Sub Sub test2() ActivePresentation.Slides(2).Select ActiveWindow.Selection.Copy ActiveWindow.View.PasteSpecial (DataType = ppPasteOLEObject) End Sub
Both of them give the desired results in PowerPoint, but in Delphi I get exceptions:
test1 line
new_slide.Design = orig_slide.Design
EOleSysError exception class with the message 'Member not found'
test2 line
ActiveWindow.View.PasteSpecial (DataType = ppPasteOLEObject)
EOleException exception class with the message 'View.PasteSpecial: invalid request. The specified data type is not available'
I use the slide sorter view, copying and pasting work fine, I'm just trying to add the "keep original formatting" command.
Thanks in advance
Milan source share