VBA - checking if a presentation is already open

S

simonc

I'm writing a macro which needs to create an instance of powerpoint if there
isn't one, then open a selected presentation if it isn't already open. I've
managed the first bit ok, but I'm not sure how to test if the presentation I
want to use the macro on is already open. The presentation has been selected
using a GetOpenFilename dialogue box so its full file pathname is in a string
variable.

Grateful for advice.
 
J

John Wilson

Can you not loop through all open presentations and check the .fullname
property against the path to your target file?

Something like:

Dim opres as Presentation
For each opres In Application.Presentations
If opres.FullName = "xyz" Then msgbox "It's open"
Next opres

(Air code I haven't tried this!)
-------------------------------------------
Amazing PPT Hints, Tips and Tutorials

http://www.PPTAlchemy.co.uk
http://www.technologytrish.co.uk
email john AT technologytrish.co.uk
 
S

simonc

Thank you for this. It was so simple somehow I couldn't see it.

I have another query:

I have successfully referenced Microsoft Excel to be able to use
GetOpenFileName (I'm still using Office 2000). When I use this in an Excel
macro it remembers the last folder I opened with the macro, but in this
Powerpoint macro it doesn't, and defaults to the My documents folder. Is
there something else I need to do to get the macro to remember the last
folder?

Many thanks
 

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