Software⏱️ 3 min read📅 2026-06-11

How to Fix error 1004 Error – VBA Runtime error 1004: Method 'OpenText' of object 'Workbooks' failed

Excel 2010 VBA Runtime error 1004: Method 'OpenText' of object 'Workbooks' failed.

Quick Answer: Check the Origin argument in the OpenText method, as it may be causing an issue with encoding or compatibility.

After an upgrade to Excel 2010 from Excel 2003, a script used for standardizing data from Access has stopped working due to a VBA runtime error 1004. The error occurs when trying to open a workbook using the OpenText method.

This issue is frustrating because it prevents the script from running correctly, and it's essential to resolve it as soon as possible.

⚠️ Common Causes

  • The primary reason for this error is that Excel 2003 uses a different origin value (-535) than Excel 2010 (65001). The OpenText method requires the correct origin value to open the workbook correctly.
  • Another potential cause could be issues with the file format or encoding, but based on the information provided, the origin value is the most likely culprit.

🛠️ Step-by-Step Verified Fixes

Resolving the issue by changing the origin value

  1. Step 1: Open Excel 2010 and go to the Visual Basic Editor by pressing Alt + F11 or navigating to Developer > Visual Basic.
  2. Step 2: In the Visual Basic Editor, locate the macro that contains the OpenText method and click on it to open its code module.
  3. Step 3: Change the origin value from -535 to 65001 in the OpenText method. This will ensure that Excel 2010 can correctly identify the workbook file format and open it without errors.
  4. Step 4: Save the changes and test the macro again to verify that it works as expected.

Alternative approach: Checking for compatibility issues

  1. Step 1: Try opening the workbook in Compatibility Mode to see if it resolves the issue. Go to File > Save As and select Excel 2003 or earlier from the Compatibility Mode dropdown menu.
  2. Step 2: If the workbook opens correctly in Compatibility Mode, it may indicate that there's an issue with the file format or encoding that needs to be addressed.

🎯 Final Words

By changing the origin value or checking for compatibility issues, you should be able to resolve the VBA runtime error 1004 and get your script working again.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions