How to Use VBA to Open an Embedded Excel File in PowerPoint
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.

- 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.
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.
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.
Determine the target slide number and the specific name of the embedded Excel shape (for example, Slide 1, Shape "XL1").
Press Alt + F11 to open the Visual Basic for Applications editor and insert a new Module.
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.
Run the macro while your presentation is in Edit View. The embedded Excel file will automatically open.

Manually Open the Embedded Excel Object
If you only need to access the data occasionally without setting up a macro, you can open it directly from the slide.
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. Open your file: Launch WPS Presentation and open the presentation file containing your embedded Excel object.
- 2. Access Developer tools: Navigate to the 'Developer' tab on the top ribbon menu to access macro and scripting features.
- 3. Open VBA Editor: Click on 'Visual Basic' or 'Macros' to launch the VBA editor and insert a new module.
- 4. Input the macro code: Type or paste your OLEFormat.DoVerb script, ensuring you target the correct slide index and shape name.
- 5. Run the macro: Execute the script to automatically open and manage the embedded Excel chart data.

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.




