subject: How to Fix Runtime Error 1004 [print this page] How to Fix Runtime Error 1004 How to Fix Runtime Error 1004
Typical reasons behind the occurrence of runtime errors include memory issues, computer viruses, software-related problems, and conflicts between programs.
What is Runtime Error 1004?
Runtime error 1004 is often accompanied by some text such as "Copy method of worksheet class failed," "Programmatic access to Visual Basic Project is not trusted," or "Application-defined or object-defined error." If course, lots of variations to this message exist. Runtime error 1004 is sometimes generated while using Microsoft Excel or Visual Basic.
How to Fix Runtime Error 1004: Use a Registry Cleaner
Since runtime files can be found within the registry, using a reliable registry cleaner can fix this type of problem more often than not. As you install programs, use programs, and uninstall programs, small changes can occur leading to broken entries within the registry. Using a registry cleaner should repair the broken entries.
1) Download a reputable registry cleaner.
2) Install the registry cleaner properly.
3) Run the registry cleaner on the computer to fix broken or missing files.
How to Fix Runtime Error 1004: Visual Basic
Just follow one of these sets of directions to resolve a runtime error that occurs while using Visual Basic within Excel.
Set 1:
1) Open your Microsoft Excel application.
2) Select Tools from the top of the menu.
3) Select Macros.
4) Select Security.
5) Select "Choose trusted publisher" from the Security dialog box.
6) Select "Trust Access to Visual Basic Project."
7) Select Ok.
Set 2: Problems copying and pasting data
1) Change the VBA Macro code so that it only copies and pastes a single row, specifically the portion of the row that contains the data.
OR
2) Change the VBA Macro code so that it loops to copy and so that it pastes smaller ranges of data.
How to Fix Runtime Error 1004: Microsoft Excel
If you receive the runtime 1004 error along with this text: "Method on Key Up Object_Application Failed," use these directions:
Right click on Start.
Select Explorer.
Open C:Program FilesMS OfficeXLSTART directory.
Delete this file: GWXL97.XLA.
Close Explorer.
Open your Microsoft Excel application.
How to Fix Runtime Error 1004: Copying and Pasting in Microsoft Excel
When runtime error 1004 occurs while using Excel, it is usually generated by copying the worksheet more than once without saving your work and closing the workbook in between. The easiest strategy here is to prevent runtime error 1004 from occurring simply by saving and closing the worksheet periodically. This strategy also varies according to the size of your worksheet, so you might need to close the application more frequently in some instances.
It is also possible to use the following directions to work around this problem when using Microsoft Excel.
Microsoft Excel 2003 or Earlier Version
1) Create a new workbook in Excel.
2) Delete all but one of the worksheets.
3) Format the workbook.
4) Add any data, charts, or text that you wish to have within the template by default.
5) Navigate to File and select Save as.
6) Select Template (*.xltx) in the Save as Type list and click on Save.
7) Use the code listed here if you wish to insert the template programmatically: Sheets.Add Type:=pathfilename where pathfilename refers to the full path and the full file name for your template.
Microsoft Excel 2007
1) Create a new workbook in Excel.
2) Delete all but one of the worksheets.
3) Format the workbook.
4) Add any data, charts, or text that you wish to have within the template by default.
5) Select the "Microsoft Office Button" and select Save As.
6) Type the name that you wish to use to save the file in the File Name box.
7) Select Template (*.xltx) in the Save as Type list and click on Save.
8) Use this code if you wish to insert the template programmatically: Sheets.Add Type:=pathfilename where pathfilename refers to the full path and the full file name for your template.