How to select the next slide?

A

Adam Clark

Your post about how to PasteSpecial using Application.View just saved me a lot of time.

But how should we select the newly added slide?



Rob Pascale wrote:

Pasting Excel/Word Tables to PowerPoint Fix
13-Feb-09

I just finished speaking with Microsoft about pasting Excel Ranges or Word tables into PowerPoint using VBA.


Assume currSlide is a Slide object.

Rather than pasting the clipboard contents to the Shapes Collection:
currSlide.Shapes.Paste

Paste to the View of the ActiveWindow:
currSlide.Application.ActiveWindow.View.Paste


This does not require you to re-create the tables or paste as pictures. However, if you are creating multiple slides, you will need to make sure you select the newly added slide before using the paste command above.

I hope others get use out of this fix as well.

EggHeadCafe - Software Developer Portal of Choice
Multiple Login Check with Session Pinging
http://www.eggheadcafe.com/tutorial...0-105e52d17cd6/multiple-login-check-with.aspx
 
R

Rob Pascale

Glad to hear it!
Here's a basic rundown of how I'm using it (setting a Slide object from the AddSlide function, selecting that Slide object, then pasting to the application view)


Dim oPPT As Object
Dim myPPT As PowerPoint.Presentation
Dim currSlide As Slide
Dim myLayout As CustomLayout


Set oPPT = CreateObject("PowerPoint.Application")
oPPT.Visible = msoTrue
Set myPPT = oPPT.Presentations.Add

'This is the layout being used for new slides
Set myLayout = myPPT.Designs("Report").SlideMaster.CustomLayouts(1)

'Loop this as necessary
Set currSlide = myPPT.Slides.AddSlide(myPPT.Slides.Count + 1, myLayout)
currSlide.Select
currSlide.Application.ActiveWindow.View.Paste




Adam Clark wrote:

How to select the next slide?
13-Oct-09

Your post about how to PasteSpecial using Application.View just saved me a lot of time.

But how should we select the newly added slide?

EggHeadCafe - Software Developer Portal of Choice
Professional ADO.NET 2.0 Programming [Wrox]
http://www.eggheadcafe.com/tutorial...88c4-7949157d13db/professional-adonet-20.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top