Activating the right presentation in VBA

J

JS

Hi All:
I need to open several PPT presentations and then activate each one in turn.
I tried:
For PptNum = 1 To Application.Presentations.Count
Windows(PptNum).Activate
But the file opening order and the order of files shown in Windows any times
are not the same, and many times while VBA codes does things to one file I
see another file... I tried:
Application.Presentations(PptNum).Activate
but this does not work
Could someone please give me a hand here?
Thanks in advance, JS
 
D

David M. Marcovitz

I believe the order of Windows changes so that Windows(1) is always the
currently active presentation. You might want to always look at Windows
(Application.Presentations.Count) because that should be the backmost
Windows, I think as in:

For PptNum = 1 To Application.Presentations.Count
Windows(Application.Presentations.Count).Activate

I think (but I'm not sure), activating the last Window will make that
number 1 and move the rest back so you have a new last Window that will
be the next one activated. No guarantees, but it is worth a try.

--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/
 
S

Shyam Pillai

Look at the open presentation as a stack. When you move something out of
order to the top, the others fall down occupy it's place. The topmost window
is always number 1, the bottom most would be the nth window. So Windows(x)
would refer to the presentation window which is at x and not necessarily the
presentation that was the xth to be opened. Also, you can have more than one
window for a presentation.

--
Regards,
Shyam Pillai

Animation Carbon
http://www.animationcarbon.com
 
J

JS

Hi David and Shyam:
Thank you both for your input.
I'm trying to put some code together that will Find a given text string in
all presentations that are open, display the presentation & slide where this
text was found, highlight/blink the found text (no idea how to do this) and
ask if Yes/No want to replace with a Replacement string. This is proving to
be challenging... Any ideas?
Again, Thanks and Regards, JS

Hum... I wonder if I should try to loop through open presentations using
Windows instead of
 

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