Fix runtime error 1004 – macro cannot be executed in Excel

runtime error 1004 - macro cannot be executed in Excel

MS Excel is a very popular spreadsheet program that is used worldwide to store, organize and manipulate data. It is used for both personal and professional purposes and is available in two extensions, XLS and XLSX. But in addition to its popularity, it turns out to be corrupted and because of that, it starts giving the 1004 runtime error.

The Excel 1004 error is one of those annoying runtime errors that occur mostly when working with an Excel file. Or when you try to create a macro in an Excel document, which causes you to not be able to do anything in the workbook.

This error can cause serious problems when working with Visual Basic applications and cause the program or system to crash or, in some cases, hang for a while. This error occurs in all versions of MS Excel, such as Excel 2007/2010/2013/2016/2019.

Here, in this article, we will discuss this common execution error 1004 in Excel 2019, 2016 2013, and earlier versions.

What is the cause of execution error 1004 – macro cannot be executed in Excel

What is the cause of execution error 1004 - macro cannot be executed in Excel

If you want to know how to properly fix the 1004 execution error in Excel, you need to understand the causes of this problem. The main reasons are as follows.

Macro name error: The macro being executed copies the original worksheet into a workbook with a specific name that you didn’t save and close before running the macro.

File conflict: When you open an Excel VBA file, it conflicts with other programs.

Too many legend entries: An Excel chart contains more legend entries than there is room to display legend entries on the chart.

Damaged Excel file: your .xls files have been corrupted, infected, or corrupted.

To resolve runtime error 1004 – macro cannot be executed in Excel

To resolve runtime error 1004 - macro cannot be executed in Excel

Enable the “Trust VBA project object model access” option

  1. The first thing you need to do here is to open Excel Options, which is very easy.
  2. Just open Microsoft Excel, then click File and select Settings.
  3. Once under Settings, click on Trust Center, and then click on Trust Center Settings.
  4. Immediately, you should see the Trust Options section. From there, select Macro Settings.
  5. Finally, click on Trust access to the VBA project object model, then click the OK button and you’re done.

Checking for Malware

As a precautionary measure, you should also check for malware. Therefore, run an anti-virus scanner and check regularly to see if anything has appeared. If nothing appears, we recommend running a full virus scan to make sure that everything is OK.

Microsoft Defender is a great tool for this task, but if it doesn’t work for you, we recommend using a free standalone malware scanner.

Frequently Asked Questions

  1. Delete the GWXL97.XLA files.
  2. Check the trusted access to the VBA project object model.
  3. Create another Excel template.
  4. Repair the corrupted Excel file.

  1. Go to the Task Manager and stop all running programs.
  2. Then go to the Start menu -> and select Control Panel.
  3. Then select Add or remove a program from the Control Panel.
  4. Here, get a list of programs currently installed on your computer, then select Microsoft Word from the list.

  1. Click on Microsoft Office, then click on Excel Options.
  2. Click on Trust Center.
  3. Click on Trust Center Settings.
  4. Click on Macro Settings.
  5. Select the Configure access to the VBA project object model check box.

Runtime error `1004` - Programmatic access to Visual Basic project is not reliable (Mac) This error occurs in Office 2016 or Office 2019 in Mac version. This error is caused by Microsoft adding a security setting to Office settings.