logo
search
VBA & Macro Problems

Fix Excel Macro Error 1004 ODBC After 32-bit to 64-bit Upgrade

Huda QurayshiHuda Qurayshi Oct 12, 2026 868 views

Question details

The user needs to fix a macro failure that occurs after migrating from a 32-bit to a 64-bit version of Office.

How to Fix Excel Macro ODBC Error 1004 After Upgrading to 64-bit
Product
Microsoft Excel
Device & OS
not provided
Scenario
Running a VBA macro to refresh a QueryTable connected to an external database in a newly upgraded 64-bit Excel environment.
Observed behavior
The macro halts execution and displays 'Run-time error 1004: General ODBC Error', specifically highlighting the line 'Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False'.
Before you start

Ensure you have administrator privileges on your computer, as resolving ODBC architecture mismatches requires installing new 64-bit database drivers.

Solution 1Recommended

Install and Configure the 64-bit ODBC Driver

64-bit Excel cannot communicate with 32-bit ODBC drivers. You must install the 64-bit equivalent of your database driver to refresh your QueryTable.

When upgrading from Office 2019 32-bit to Office 2021 64-bit, the underlying architecture changes. Data Source Names (DSNs) and ODBC drivers configured for 32-bit applications are invisible to 64-bit applications. To fix the General ODBC Error, the correct 64-bit driver must be installed and configured.

1
Identify the required driver

Check your macro's connection string or the existing 32-bit ODBC settings to identify which database system (e.g., SQL Server, MySQL, Oracle) the workbook connects to.

2
Download the 64-bit driver

Visit the database vendor's official website and download the 64-bit version of the ODBC driver.

3
Install the driver

Run the downloaded installer and follow the on-screen prompts to install the 64-bit driver on your Windows system.

4
Configure the 64-bit DSN

Press the Windows key, search for 'ODBC Data Sources (64-bit)', and open the application. Recreate your System or User DSN exactly as it was named in the 32-bit version so your Excel macro can recognize it.

Install and Configure the 64-bit ODBC Driver
Verify DSN Name: If you use the exact same DSN name in the 64-bit ODBC Administrator, you will not need to change the connection string inside your VBA macro.
Free Microsoft Office alternative

Try WPS Office for Seamless Spreadsheet Management

Struggling with complex architecture upgrades and macro errors? WPS Office provides a highly compatible, lightweight, and free alternative to Microsoft Office. It handles standard spreadsheet formats effortlessly, allowing you to focus on your data without the steep troubleshooting curve.

  1. 1. Download the software: Visit the official WPS website and download the free WPS Office suite.
  2. 2. Install WPS Office: Run the installer and follow the quick setup instructions.
  3. 3. Open your files: Launch WPS Spreadsheets and open your existing Excel workbooks to seamlessly continue your work.
Free to download and use with a clean, familiar interfaceFully compatible with Microsoft Excel (.xlsx, .xls) and macro-enabled filesLightweight application that installs quickly and runs smoothly on standard PCsBuilt-in robust tools for data analysis and visualization
microsoft office alternative - wps office

Frequently Asked Questions

Why does my Excel macro work in Office 32-bit but fail in Office 64-bit?

Office 64-bit requires all external dependencies, such as database drivers and API libraries, to also be 64-bit. If your macro attempts to call a 32-bit ODBC driver, it will fail because the architectures are fundamentally incompatible.

What does Run-time error 1004 General ODBC Error mean?

This error indicates that Excel could not establish a connection to an external database. In the context of migrating to a 64-bit environment, it almost always means the required 64-bit ODBC driver is missing or incorrectly configured.

How do I access the 64-bit ODBC settings on Windows?

Click the Windows Start button, type 'ODBC' in the search bar, and select 'ODBC Data Sources (64-bit)' from the list of results. This tool allows you to configure connections specifically for 64-bit applications like Excel 2021 64-bit.