How to Repair Runtime Error 1004 in Microsoft Excel

Microsoft Excel is a very popular spreadsheet and is used worldwide to store, organize and edit data. This is used for both individual and commercial purposes. This is available in two extensions in XLS and XLSX format. However, aside from its popularity, it turns out to be corrupt and therefore indicates runtime error 1004.

The Excel 1004 error is one of the annoying runtime errors that mainly occur when using the Excel file. Or you try to generate macros in the Excel document and therefore there is nothing you can do in your workbook.

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

“Run-time error ‘1004’:
Copy Method of Worksheet Class failed”

“Run-time error ‘1004’:
Application-defined or object-defined error”

Even the exact error message you see may vary slightly in some cases, although the error code remains the same. Regardless of the version of the problem you are experiencing, it almost always occurs when you run a macro in Excel to copy worksheets and then place the copies in the same workbook as the worksheet. Original.

In contrast to the worst technical problems, the cause of runtime error 1004 in Microsoft Excel is known. Run-time error 1004 occurs when the running macro copies the original worksheet to a workbook with a defined name that was not saved and closed before the macro was run.

Enable the Trust Access to VBA Project Object Model

  • Start Microsoft Excel
  • In the menu bar, select “File”> “Options [Excel]”> “Trust Center”> “Trust Center Settings”> “Macro Settings”.
  • Activate the option button “Deactivate all macros with notification” in the upper area.
  • In the lower area, check the box next to “Trust access to VBA project object model”.
  • Click “OK” and “OK” to save the settings
  • Close Excel

Create Another Excel Template

  • Start Microsoft Excel on your computer.
  • Then create a new Microsoft Excel workbook by pressing the CTRL + N combination or by selecting Blank Workbook on the first screen.
  • After creating the workbook, delete all sheets in the workbook with one exception.
  • Format the workbook you saved.
  • You can edit this workbook as you wish.
  • Finally, go to File> Save As to save the file in Excel template file format (.xltx or .xlt).
  • Use this format for Excel in 2017 and later versions.
  • If the document was saved correctly, you can insert the template using the following code:
  • Add type: = path name
  • Remember to replace the file name with the actual document name.

Repair the Damaged Excel Application

  • First go to C:\Program Files\MSOffice\Office\XLSTART and delete the file GWXL97.XLA.
  • Restart Excel and try again to see if runtime error 1004 was removed in the VBA project.

Conclusion

Knowing the full details of some issues that damage workbooks can be very helpful. This can be troublesome even for a VBA encoder that works on a table for calculations. This article can help you analyze the root cause and take appropriate corrective action. This article contains everything you need to know to fix runtime error 1004 in Excel VBA. In most cases, the problem can be solved by implementing the manual steps listed here. This is not often the case and you can opt for the third-party tool mentioned here. It is very efficient and guarantees the complete recovery of any lost data or financial records. Try downloading and using the demo version to fix an unlimited number of Excel files for free.

https://answers.microsoft.com/en-us/msoffice/forum/msoffice_excel-mso_winother/excel-vba-run-time-error-1004-application-defined/0211771e-8f9a-478a-9c61-ad00aaaaabfe