VBA & Macro Problems

Fix Excel VBA Refresh Query Error for SharePoint Users

John WilsonJohn Wilson Nov 2, 2026 868 views

Question details

Users need to resolve a run-time error that occurs when executing a VBA macro to refresh a query connection in an Excel workbook hosted on SharePoint.

How to Fix Excel VBA Refresh Query Error for SharePoint Users
Product
Microsoft Excel
Device & OS
not provided
Scenario
A shared workbook on SharePoint contains a VBA macro designed to refresh query connections, which is executed by multiple users across different Excel versions.
Observed behavior
The VBA macro successfully refreshes the query for Microsoft 365 users but produces a run-time error for Office 2016 users, even though the manual 'Refresh All' button works for everyone.
Before you start

Ensure that all affected users have sufficient SharePoint permissions to access the connected data sources and try running the macro on a downloaded local copy of the workbook to isolate network issues.

Solution 1Recommended

Standardize Excel Versions and Bitness

Mismatched Excel versions handle query object models differently, which is the primary cause of VBA run-time errors when refreshing modern connections.

Microsoft 365 and Office Professional Plus 2016 expose different Power Query features to VBA. A macro recorded or written in Microsoft 365 may reference query properties that do not exist in the 2016 object model.

1
Check current Excel versions

Have all users open Excel, click on 'File' in the top ribbon, and select 'Account' to view their exact Office edition and version number.

2
Verify Office bitness

In the same 'Account' menu, click 'About Excel' to check whether the installation is 32-bit or 64-bit, as mixed bitness can break ODBC and OLEDB connection drivers.

3
Standardize the environment

Update all affected users to Microsoft 365 to ensure full compatibility with the latest Power Query features and VBA object models.

Standardize Excel Versions and Bitness
Version Capabilities: If updating Office is not immediately possible, users on older versions can still bypass the macro and manually click 'Refresh All' under the Data tab as a temporary workaround.
Free Microsoft Office alternative

Use WPS Office for Reliable Data Processing

If version compatibility issues and VBA run-time errors in Microsoft Excel continue to disrupt your team's workflow, consider switching to WPS Office. It provides robust spreadsheet management, excellent compatibility with complex files, and a stable environment for your daily data tasks.

  1. 1. Download and Install: Visit the official WPS website to download and install the free WPS Office suite.
  2. 2. Open your Spreadsheet: Launch WPS Spreadsheet and open your existing .xlsm or .xlsx file directly from your local drive or cloud storage.
  3. 3. Manage Data and Macros: Navigate to the Data tab to manage your connections, or use the Tools tab to access the built-in Macro editor seamlessly.
Excellent compatibility with Microsoft Excel (.xlsx, .xlsm) formatsConsistent macro and VBA support without complex versioning issuesLightweight application that runs smoothly across all devicesFree to download and use for standard spreadsheet operations
microsoft office alternative - wps office

Frequently Asked Questions

Why does the VBA query refresh work for one user but produce a run-time error for others?

This usually happens due to differences in Excel versions, such as one user having Microsoft 365 while others have Office 2016. Newer versions support updated Power Query object models that older versions do not recognize, causing the VBA script to fail.

Can I manually refresh the query if the VBA macro fails?

Yes. Even if the VBA macro returns a run-time error, users can typically bypass the script by navigating to the 'Data' tab in the Excel ribbon and clicking 'Refresh All' to update the queries manually.

Does storing the Excel file on SharePoint cause VBA run-time errors?

Hosting the file on SharePoint does not change the VBA syntax, but strict SharePoint permission levels, missing trusted locations, or network sync issues can occasionally prevent macros from fetching external data successfully.