Reputation: 51
I am working on exporting Contents from Excel to PowerPoint. I have a blank formatted slide in my PowerPoint presentation which I Need to duplicate everytime and write on it. The Problem is that my code adds a new slide ahead of the current slide which is posing Problems in writing the Contents to the exact slide number. I want that the new slide should be added after the current slide.
Set pptSlide = oPPTApp.ActivePresentation.Slides(1).Duplicate.Item(1)
oPPTFile.Slides(SlideNum).Select
Set oPPTShape = oPPTFile.Slides(SlideNum).Shapes("Table 1")
any Suggestions ?
Upvotes: 0
Views: 7956
Reputation: 1
ActivePresentation.Slides.Range(1).Cut
ActivePresentation.Slides.Paste -1
this function will move the first slide to the last. so it stands to reason you could figure out a formula to keep track of where you want the slide inserted. if you need to know how many slides are in the range it's ActivePresentation.Slides.Range.count
Upvotes: 0
Reputation: 14809
There's almost NEVER a good reason to select anything when automating PPT. Assuming a shape named Table 1 on Slide 1, this should do what you want:
Dim oSl As Slide
Dim oSh As Shape
Set oSl = ActivePresentation.Slides(1).Duplicate()(1)
Set oSh = oSl.Shapes("Table 1")
Upvotes: 2