UpdateExcelRange method updates one existing Grunt chart or table per call. It identifies the object by its PowerPoint shape name and replaces its source range. You can call the method several times to update multiple objects in the same presentation.
Grunt exposes this method through the Windows PowerPoint COM add-in. VBA accesses the add-in object through PowerPoint’s COMAddIns collection and calls the method with late binding. You do not need to add a Grunt type-library reference to your VBA project.
VBA automation is available in the Windows PowerPoint COM add-in. It is not available on Mac.
When to use VBA automation
Use VBA automation when:- An Excel macro already prepares the data for your presentation.
- You produce the same presentation with new data on a regular schedule.
- You need to update several named Grunt objects in one automated process.
- You want to keep the presentation’s layout and formatting separate from the workbook data.
- You are migrating an existing Excel-to-PowerPoint automation workflow to Grunt.
Before you start
Make sure that:- Grunt is running in PowerPoint.
- The target presentation is open.
- The target Grunt chart or table has a unique PowerPoint shape name.
- The Excel workbook is saved and the source range is available.
Name the Grunt object
Give each object that you want to update a unique name:- In PowerPoint, select the entire Grunt chart or table.
- Right-click the object.
- Click Rename PowerPoint shape….
- Enter a unique name, such as
Revenue chart. - Click Rename.
Add the macro in Excel
This example updates a Grunt object namedRevenue chart from cells A1:D6 on the Data worksheet:
Example files
Download both example files to see the complete workflow:- Download the Excel workbook. It contains the
UpdateAllChartsmacro, a Connections table, and sample data for three Grunt charts. - Download the PowerPoint presentation. It contains the named Grunt objects that the workbook updates.
- Download and open both files.
- In PowerPoint, make the example presentation the active presentation.
- In Excel, review the Connections table or edit the yellow cells on the data worksheets.
- Press Alt+F8, select
UpdateAllCharts, and click Run.
Understand the arguments
UpdateExcelRange accepts four arguments:
If the object already has an Excel connection, Grunt changes the connection to the supplied range. If the object contains embedded data, Grunt creates an Excel connection for it.
The call starts the data refresh and then returns control to Excel. The new data may appear shortly after the macro continues. If your macro saves or exports the presentation, wait until the Grunt object has finished updating first.
Handle errors
Add a VBA error handler when the macro runs as part of a larger process:Err.Description when the call fails.
Troubleshoot VBA updates
The automation object is Nothing
Confirm that the current Grunt add-in is installed and loaded in PowerPoint. Close and reopen PowerPoint after updating Grunt.
Grunt cannot find the object
Check the name in PowerPoint and in the macro. The name can use different capitalization, but it cannot contain spelling differences. Use Rename PowerPoint shape… to set the name again if needed.Grunt finds multiple objects
Rename each duplicate so that the target name is unique across the presentation.Grunt cannot find the presentation session
Open the target presentation in PowerPoint before you run the macro. Make surepresentation refers to that open presentation.
The macro finishes before the object updates
The data refresh continues afterUpdateExcelRange returns. Wait for the object to update before you save, export, or close the presentation.