PowerPoint VBA: Getting the Path to an Active Presentation

Sometimes I want to get the path to an active PowerPoint presentation.
The following PowerPoint VBA macro displays it in a message box. (The path doesn’t include the name of the presentation file.)

Macro Example

Sub GetActivePresentationPath()
 
  MsgBox ActivePresentation.Path

End Sub

Description

(Application.)ActivePresentation

  ActivePresentation...

The Application.ActivePresentation property returns the active Presentation object.

obj-PowerPoint-Application-ActivePresentation

The ActivePresentation property is a member of the PowerPoint.Global class, so we can omit the Application property.

obj-PowerPoint-ActivePresentation

ActivePresentation.Path (Presentation.Path)

  ActivePresentation.Path

The Presentation.Path property (ActivePresentation.Path) returns a String that represents the path to the Presentation.

obj-PowerPoint-Presentation-Path

MsgBox

The code: ActivePresentation.Path is is set to the parameter of the MsgBox function.

Sub GetActivePresentationPath()
 
  MsgBox ActivePresentation.Path

End Sub

So, a message box shows the path to the active presentation.

Properties

http://www.relief.jp/itnote/archives/003474.php

Apply to

  • PowerPoint 2013
  • PowerPoint 2010
  • PowerPoint 2007