How to Open an Existing PowerPoint File using Excel VBA – 5 Steps

You have a blank PPT file saved in Drive (D:).

open existing powerpoint from excel vba


Step 1 – Launch the Developer Tab

  • Right-click the ribbon.
  • Select Customize the Ribbon.

open existing powerpoint from excel vba

  • In Excel Options, go to Customize Ribbon.
  • Check Developer in Main Tabs.
  • Click OK.

The Developer tab will be displayed on the ribbon.

open existing powerpoint from excel vba


Step 2 – Create a CommandButton

  • Go to the Developer tab.
  • Click Insert in Controls.
  • Select CommandButton in ActiveX Controls.

  • Drag your mouse and place the button in the worksheet.
  • Click it.

The Visual Basic Editor will be displayed.


Step 3 – Enable the PowerPoint Object Model

  • Go to the Tools tab.
  • Click References.

  • In the References – VBAProject window, check Microsoft PowerPoint 16.0 Object Library.
  • Click OK.

open existing powerpoint from excel vba


Step 4 – Use a VBA Code

  • Enter the following VBA code:

VBA Code:

Private Sub CommandButton1_Click()
Dim PwrApp As PowerPoint.Application
Dim PwrPre As PowerPoint.Presentation
Dim PwrSd As PowerPoint.Slide
Set PwrApp = New PowerPoint.Application
Set PwrPre = PwrApp.Presentations.Open("D:\Presentation1.pptx")
End Sub

open existing powerpoint from excel vba


Step 5 – Final Output

  • Go back to your worksheet and click CommandButton1.

This will open the existing file.


How to Create a PowerPoint File with Excel VBA

STEPS:

  • Go to the Developer tab.
  • Click Visual Basic in Code to open the Visual Basic Editor. You can also press Alt + F11.

  • Alternatively, right-click the worksheet and go to View Code.

open existing powerpoint from excel vba

 

  • Select Module in Insert.

open existing powerpoint from excel vba

 

  • Enter the VBA code below:

VBA Code:

Sub Create_PPT()
    Dim PwrApp As PowerPoint.Application
    Dim PwrPre As PowerPoint.Presentation
    Dim PwrSde As PowerPoint.Slide
    Dim PwrShpe As PowerPoint.Shape
    Dim PwrChrt As Excel.ChartObject
    Set PwrApp = New PowerPoint.Application
    PwrApp.Visible = msoCTrue
    PwrApp.WindowState = ppWindowMaximized
    Set PwrPre = PwrApp.Presentations.Add
    Set PwrSd = PwrPre.Slides.Add(1, ppLayoutTitleOnly)
End Sub
  • Run the code by clicking RunSub or pressing F5.

open existing powerpoint from excel vba

This will create a PowerPoint slide.

Read More: [Solved] Embedded Excel in PowerPoint Not Showing All Data


Download Practice Workbook

Download the workbook and practice.


Related Articles

<< Go Back to Excel to PowerPoint | Export Data from Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Sabrina Ayon
Sabrina Ayon

Sabrina Ayon, a Computer Science and Engineering graduate from United International University, has been an integral part of the ExcelDemy project for two years. She authored 150+ articles, excelling in instructing through visually engaging Excel tutorials. With a passion for teaching, Sabrina conducted sessions on Excel VBA, sharing her knowledge and insights with others. Currently holding the position of Project Manager for the ExcelDemy Visual Development Project, she oversees various aspects of the project, ensuring its smooth operation... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo