Running a Ppt command from Word - problem

  • Thread starter christophercbrewster via OfficeKB.com
  • Start date
C

christophercbrewster via OfficeKB.com

[The following problem is something that I thought was already working-- not
sure.] My code creates a reference in Word that, when clicked, displays the
named slide in Powerpoint. The system knows what Ppt file to look for, and it
first has to make sure that this file is the active presentation. But when it
finds the right presentation, the Activate command doesn't work. If a
different file is active, the "correct" slide (by number) is displayed but in
the wrong presentation. Here's some code, edited to show the pieces that are
relevant. The oPPT object is working correctly in other respects. I'd
appreciate if someone can suggest why the Activate command has no effect.

Set oPPT = GetObject(, "PowerPoint.Application")
...
For Each oPres In oPPT.Presentations ' Find the specified
open presentation
If oPres.Name = PptFileName Then ' If the pres is
found open...
oPPT.Presentations(PptFileName).Activate ' NO EFFECT: Activate
presentation
...

--
Christopher Brewster
Lockheed Martin, Eagan MN

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/word-programming/200904/1
 
C

christophercbrewster via OfficeKB.com

Ouch, I posted that too soon. It worked (or seemed to) and now it's a no-op
like my earlier one. Suggestions still needed.
I found my error. The Activate command is the following, where
PptFileNamePath is the file's full pathname.

oPPT.Presentations.Activate FileName:=PptFileNamePath

--
Christopher Brewster
Lockheed Martin, Eagan MN

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/word-programming/200904/1
 
C

christophercbrewster via OfficeKB.com

A macro running in Powerpoint activates an already-open presentation as
follows:

Application.Presentations(presName).Windows(1).Activate

So it seems the following should work in Word, where oPPT is the Powerpoint
object.

oPPT.Presentations.Activate(presName).Windows(1).Activate

Any idea why it doesn't work?
 

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