VBA & Macro Problems

How to Use VBA to Open an Embedded Excel File in PowerPoint

Chanuka GeekiyanageChanuka Geekiyanage Oct 22, 2026 869 views

Question details

The user needs a programmatic way to automatically open an embedded Excel workbook used as chart data within a PowerPoint presentation via a VBA macro.

How to Use VBA to Open an Embedded Excel File in PowerPoint
Product
PowerPoint
Device & OS
not provided
Scenario
Automating PowerPoint presentations that contain embedded Excel chart data to streamline editing and updates.
Observed behavior
The user wants the embedded Excel object to open programmatically during the edit view rather than having to manually double-click it.
Before you start

Ensure that the Developer tab is enabled in your PowerPoint ribbon and that you know the specific shape name of the embedded Excel object on your slide.

Solution 1Recommended

Use the OLEFormat.DoVerb Method in VBA

This method allows you to programmatically trigger the 'Open' action for an OLE object embedded in a PowerPoint slide.

In PowerPoint, embedded objects like Excel files are treated as Shapes. You can use the OLEFormat.DoVerb method with an action verb index (such as 1) to simulate a user double-clicking or right-clicking to open the object.

1
Identify slide and shape

Determine the target slide number and the specific name of the embedded Excel shape (for example, Slide 1, Shape "XL1").

2
Open VBA Editor

Press Alt + F11 to open the Visual Basic for Applications editor and insert a new Module.

3
Enter the OLEFormat.DoVerb code

Type the following code: ActivePresentation.Slides(1).Shapes("XL1").OLEFormat.DoVerb 1. Make sure to adjust the slide index and shape name to match your actual presentation.

4
Run the script

Run the macro while your presentation is in Edit View. The embedded Excel file will automatically open.

Use the OLEFormat.DoVerb Method in VBA
View Restriction: This VBA method only works when PowerPoint is in edit view. It will not execute correctly during an active slideshow.
Advanced Presentation Editing

Manage VBA and Embedded Objects Smoothly in WPS Presentation

WPS Office provides excellent compatibility with Microsoft PowerPoint files, including those with embedded Excel worksheets. By using WPS Presentation, you can efficiently manage your slides, update chart data, and run VBA macros seamlessly.

  1. 1. Open your file: Launch WPS Presentation and open the presentation file containing your embedded Excel object.
  2. 2. Access Developer tools: Navigate to the 'Developer' tab on the top ribbon menu to access macro and scripting features.
  3. 3. Open VBA Editor: Click on 'Visual Basic' or 'Macros' to launch the VBA editor and insert a new module.
  4. 4. Input the macro code: Type or paste your OLEFormat.DoVerb script, ensuring you target the correct slide index and shape name.
  5. 5. Run the macro: Execute the script to automatically open and manage the embedded Excel chart data.
Fully compatible with PPTX formats and embedded XLSX objectsSupports advanced macros and VBA scripts for workflow automationLightweight design ensures fast loading of heavy presentations with dataFamiliar user interface makes it easy to navigate Developer tools
microsoft office alternative - wps office

Frequently Asked Questions

Why does the OLEFormat.DoVerb method fail during a slideshow?

The OLEFormat.DoVerb method is specifically designed to function while the presentation is in edit view. If you need to interact with embedded objects during an active slideshow, you must use ActionSettings to trigger an OLE action on a mouse click.

How do I find the specific name of the embedded Excel shape in PowerPoint?

Navigate to the Home tab, click on 'Select' in the Editing group, and choose 'Selection Pane'. This pane lists all the objects on the current slide, allowing you to easily identify or rename the embedded Excel shape (such as 'Object 3' or 'XL1').

Can I edit the embedded Excel file without opening a separate Excel window?

Yes, you can edit the embedded file in-place. Right-click the embedded object, hover over 'Worksheet Object', and select 'Edit' instead of 'Open'. This activates the Excel editing tools directly within your presentation window.