Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General PowerPoint Questions / November 2006

Tip: Looking for answers? Try searching our database.

Programmatically copying an object from one presentation to anothe

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Barb Reinhardt - 15 Nov 2006 13:19 GMT
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
Michael Koerner - 15 Nov 2006 15:29 GMT
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

Signature

 Michael Koerner
MS MVP - PowerPoint

>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
Barb Reinhardt - 15 Nov 2006 15:36 GMT
I know how to do it manually.  How do I do it programmatically?  

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
[quoted text clipped - 5 lines]
> >
> > Thanks
Steve Rindsberg - 15 Nov 2006 15:45 GMT
> 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

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Barb Reinhardt - 15 Nov 2006 17:47 GMT
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?

> > 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
[quoted text clipped - 26 lines]
> PPTools:  www.pptools.com
> ================================================
David M. Marcovitz - 15 Nov 2006 18:07 GMT
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

Signature

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=?=
<BarbReinhardt@discussions.microsoft.com> wrote in
news:EB9870A0-1C33-4A53-8022-6B36C299F8D7@microsoft.com:

> Thanks for your feedback.   I'm having problems with this line:
>
[quoted text clipped - 35 lines]
>> PPTools:  www.pptools.com
>> ================================================
Barb Reinhardt - 15 Nov 2006 19:31 GMT
Thanks, that did it (after I fixed another typo as well).  :)

> 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
[quoted text clipped - 42 lines]
> >> PPTools:  www.pptools.com
> >> ================================================
Steve Rindsberg - 15 Nov 2006 22:15 GMT
> 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!

>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

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.