Programmatically copying an object from one presentation to anothe

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to copy object .shapes(j) from a presentation I'm calling oPPS to a
new pages in aPPS. How do I insert a new slide into aPPS and then copy the
shape onto that slide?

Thanks
 
Select and Copy the shape in oPPS Open aPPS and pres Ctrl+M to insert a new
slide, then paste your shape into the new slide
 
Barb Reinhardt said:
I want to copy object .shapes(j) from a presentation I'm calling oPPS to a
new pages in aPPS. How do I insert a new slide into aPPS and then copy the
shape onto that slide?

Aircode:

Dim oSl as Slide
Dim oSh as Shape

' add a new slide at the END of aPPS
' make its layout the same as the layout of the slide that hosts the shape
' you're copying
Set oSl = aPPS.Slides.Add(aPPS.SlidesCount+1, .Shapes(j).Parent.Layout)

' put your shape on the clipboard
..Shapes(j).Copy

' and paste it onto the new slide
' Shapes.Paste returns a range so set oSh = the first member of the range
Set oSh = Sl.Shapes.Paste(1)

With oSh
' do any sizing/positioning/formatting you need
End With
 
Thanks for your feedback. I'm having problems with this line:

Set oSl = aPPS.Slides.Add(aPPS.SlidesCount+1, .Shapes(j).Parent.Layout)

Probably because initially, I create a new presentation programmatically
with no slides in it. How do I address that?
 
It looks like Steve is in danger of losing his Championship Air Code
title. Trying putting a dot between Slides and Count. The fact that there
are no slides shouldn't make a difference because aPPS.Slides.Count
should be 0 so adding 1 to that will mean tht the line tries to put a
slide at position 1.
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

=?Utf-8?B?QmFyYiBSZWluaGFyZHQ=?=
 
David M. said:
It looks like Steve is in danger of losing his Championship Air Code
title.

On the contrary, this is the sort of thing that makes for Winning Air Code.
Without these little adventures, it wouldn't be worth of the name.

Thanks for the recovery services!
 
Back
Top