Does PowerPoint have similar command to ThisWorkbook (for excel)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to be able to identify the PowerPoint presentation containing the
macro that is currently running. In Excel I used ThisWorkbook which would
always return the workbook in which the code is running. Is there a similar
command in PowerPoint or a way to identify the presentation from which the
code is running?

Note: I tried using Set mypres = ActivePresentation, presname =
mypres.FullName but this did not always work because I also open other
PowerPoint presentations and which ever one is active is the one I got in the
presname variable, not the presentation with the macro code running.
 
I need to be able to identify the PowerPoint presentation containing the
macro that is currently running. In Excel I used ThisWorkbook which would
always return the workbook in which the code is running. Is there a similar
command in PowerPoint or a way to identify the presentation from which the
code is running?

Note: I tried using Set mypres = ActivePresentation, presname =
mypres.FullName but this did not always work because I also open other
PowerPoint presentations and which ever one is active is the one I got in the
presname variable, not the presentation with the macro code running.

The simplest thing would be to declare a public variable or constant in each
presentation and set its value to the name of the presentation containing the
macro or whatever other identifier you need.

This might help, though:

Debug.Print Application.VBE.ActiveVBProject.Name
Debug.Print Application.VBE.ActiveVBProject.FileName
 
[CRITICAL UPDATE - Anyone using Office 2003 should install the Critical
Update or Service Pack 1 for Office 2003 as soon as possible. From
PowerPoint, choose "Help -> Check for Updates".]

[TOP ISSUE - Are you having difficulty opening presentations in PowerPoint
that you just created (you can save, but not open)? -
http://support.microsoft.com/?id=329820]

Hello,

If none of the suggestions provided give you the functionality that you
were looking for or, if you (or anyone else reading this message) have
suggestions for how and why you think PowerPoint should provide this
functionality (or make it easier), don't forget to send your feedback (in
YOUR OWN WORDS, please) to Microsoft by either:

PREFERRED METHOD:

A) If you are using Microsoft's web-based, online newsreader for Office
communities
(http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.p
ublic.powerpoint), check to see whether or not the suggestion has been
submitted before (Show -> Suggestions for Microsoft) and, if so, add your
vote to the suggestion submission. If the suggestion has not been submitted
before, click on the "New" drop-down menu and choose "Suggestion for
Microsoft" from directly within the newsreader web page.

OR, NEXT BEST METHOD:

B) If you are using another newsreader (such as Microsoft Outlook Express),
submit your suggestion using your web browser at the following address:
http://register.microsoft.com/mswish/suggestion.asp

It's VERY important that, for EACH wish, you describe in detail, WHY it is
important TO YOU that your product suggestion be implemented. A good wish
submssion includes WHAT scenario, work-flow, or end-result is blocked by
not having a specific feature, HOW MUCH time and effort ($$$) is spent
working around a specific limitation of the current product, etc. Remember
that Microsoft receives THOUSANDS of product suggestions every day and we
read each one but, in any given product development cycle, there are ONLY
sufficient resources to address the ones that are MOST IMPORTANT to our
customers so take the extra time to state your case as CLEARLY and
COMPLETELY as possible so that we can FEEL YOUR PAIN.

IMPORTANT: Each submission should be a single suggestion (not a list of
suggestions).

John Langhans
Microsoft Corporation
Supportability Program Manager
Microsoft Office PowerPoint for Windows
Microsoft Office Picture Manager for Windows

For FAQ's, highlights and top issues, visit the Microsoft PowerPoint
support center at: http://support.microsoft.com/default.aspx?pr=ppt
Search the Microsoft Knowledge Base at:
http://support.microsoft.com/default.aspx?pr=kbhowto

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Steve,



Steve Rindsberg said:
The simplest thing would be to declare a public variable or constant in each
presentation and set its value to the name of the presentation containing the
macro or whatever other identifier you need.

This might help, though:

Debug.Print Application.VBE.ActiveVBProject.Name
Debug.Print Application.VBE.ActiveVBProject.FileName


-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
 
Steve,

I took another approach on this. I was having problems with having more
than one powerpoint presentation open/active while running the macro. For my
needs, I was able to simply look at the count as to how many presentation
were open. If more than 1, I sent message to close all other presentations
and then start the macro again.

I was hoping to be able to simple identify the powerpoint script with the
macro and make it the active presentation - which would solve the problem I
was running into. Maybe I will persure this later in my spare time.

And, thanks for all of your help over the last couple of months.

Ron
 
Back
Top