PowerPoint Macro: Getting All Open Presentations Name

Sometimes I need to make the open presentations list. So, I’ve made this macro.
This PowerPoint VBA macro allows us to get all the open presentations name.

Macro Example

Sub GetAllOpenPresentationsName()

  Dim prs As Presentation

  For Each prs In Presentations
    Debug.Print prs.Name
  Next prs

End Sub

Description

Variable Declaration

Sub...

  Dim prs As Presentation

The 3rd line declares an object variable named prs represents a Presentation object.

The Presentation object represents a single PowerPoint presentation.

obj-PowerPoint-Presentation

Starts Looping

Sub...

  Dim prs As Presentation

  For Each prs In Presentations

The 5th line starts to loop through all the elements (=Presentation) of a collection (=Presentations).

The Application.Presentations property returns the Presentations collection object.

obj-PowerPoint-Application-Presentations

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

obj-PowerPoint-Global-Presentations

The Presentations is a collection of all the Presentation objects those are currently open in PowerPoint.

obj-PowerPoint-Presentations

Outputs the presentation name

The 6th line outputs the presentation name to the Immediate Window.

Sub...

  Dim prs As Presentation

  For Each prs In Presentations
    Debug.Print prs.Name

The Presentation.Name property returns the presentation name.

obj-PowerPoint-Presentation-Name

Loops Back

The 7th line loops back to get the next presentation.

Sub...

  Dim prs As Presentation

  For Each prs In Presentations
    Debug.Print prs.Name
  Next prs

After every presentation is evaluated, this macro ends.

Sub GetAllOpenPresentationsName()

  Dim prs As Presentation

  For Each prs In Presentations
    Debug.Print prs.Name
  Next prs

End Sub

Properties

http://www.relief.jp/itnote/archives/powerpoint-vba-get-all-files-name.php

Apply to

  • PowerPoint 2013
  • PowerPoint 2010
  • PowerPoint 2007