Run time error 1004 visual basic

run time error 1004 visual basic

Start Microsoft Excel · On the Menu Bar select "File" > "[Excel] Options" > "Trust Center" > "Trust Center Settings " > "Macro Settings" · In the top section. Run-time error is an error code pertaining to Microsoft Visual Basic that has been known to affect Microsoft Excel users. Why This Visual Basic Runtime Error Occurs? · Due to corruption in the desktop icon for MS Excel. · Conflict with other programs while opening VBA Excel file.

Run time error 1004 visual basic - all clear

Overflow (Error 6)

Home ➜ VBA ➜

VBA Runtime Error occurs while you are executing a macro in Excel. It’s an error that can occur due to several reasons. In the below example, as you can see, when I run the code, it shows the run-time error ‘’. In simple words, you can also say it occurs when you can’t perform an activity with the object or the application.

In this tutorial, we will understand several other reasons for this runtime error.

Error1: VBA Run Time Error That Name is already taken. Try a different One:

As I shared above, when you try to add a sheet with the name that is already there in the workbook using a VBA code, VBA show you a run-time error with code.

Even when you try to rename a worksheet, you’ll get the same error from VBA.

In the above code, I tried to rename the sheet “Sheet2” with the name “Sheet1”, but as you can see, I already have the “Sheet1” in the workbook; VBA showed me the error code

To deal with this problem is to check if a sheet already exists in the workbook or not.

Error2: VBA Run Time Error Method “Range” of object’ _ Global’ failed:

As you know, you can create a named range in Excel, but when you try to refer to that named range using a VBA code, and you misspelled its name, you are likely to get the run-time error Method “Range” of object’ _ Global’ failed.

In the following example, I have a named range with the name “myRange”, but while writing the macro, I have misspelled it as “myRang” even though it’s a typing mistake; VBA is not that smart to identify this mistake and refer to the correct named range.

There is no named range with the name that I have mentioned, and that is why it showed me the run-time error

Error3: VBA Run Time Error Select Method of Range class failed:

When you use a VBA code to select a range that is not in the active worksheet, VBA will show you the run-time error Because, if you want to select a cell or range of cells for a particular worksheet needs to be active at that point.

You cannot select a cell from the sheet1 if the sheet2 is active right now.

As you can see in the following example, I have made the same mistake where I’m referring to cell A1 from sheet one, but sheet2 is active.

The best way to deal with this error is to activate the sheet first and then write a line of code that selects a cell or the range from that sheet. You can also check if a sheet is active or not and then select the cell from that sheet, and if somehow that sheet is not active, you can show a message to the user to activate that sheet first.

Error4: VBA Runtime Error Activate method range class failed:

Just like the above reason, when you try to activate a cell or range of cells from a specific worksheet that is not active at the moment, we will show you runtime error (Activate method range class failed:).

In the about example when I tried to activate cell A1 in the sheet1 it gave me runtime error , is the active sheet was the sheet2.

To deal with this error again you need to verify that the worksheet that you are referring to is active or not. Or you can also verify if that sheet is there in the workbook or not.

Error5: VBA Runtime Error method Sorry We couldn’t Find:

If you’re trying to open an Excel file using a path, but that workbook is not there, maybe it has been moved, deleted, or renamed. In that case, VBA will again show you a run-time error

That’s what happened in the following example where I tried to open the file with the path from my desktop, but that file is not there, and it has shown me an error.

To deal with the situation, you can use a VBA code to verify if the file that you are referring to is there in the folder or not.

Error6: VBA Runtime Error method open of object workbooks failed:

This error is also related to the workbook. So when you try to open a workbook with the name for which a book already exists and open at the moment, VBA will show you the run-time error (method open of object workbooks failed).

The same thing happened in the above example, where I tried to open a workbook that is already open, and VBA showed me a run time error ().

How to Correct VBA’s Runtime (Error )

Error is a run-time error that occurs while executing a VBA code. And all the errors that we have discussed above are due to human errors while writing the code, following the points you can use to avoid the run-time error

  1. Do a step by step code execution to see on which line the error occurs.
  2. Make sure to verify all the names of the workbooks that you are referring to.
  3. You can also use a VBA code to verify if a workbook is already opened or not.
  4. And use the activate method to activate a worksheet before you refer to a cell or range from it.

More on VBA Errors

Subscript Out of Range (Error 9) Object Doesn’t Support this Property or Method (Error ) Invalid Procedure Call Or Argument (Error 5)

Tips To Fix Ms Project Vba Runtime Error


  • Step 1: Download and install the software
  • Step 2: Open it and click on the "Restore" button
  • Step 3: Select the backup you want to restore from and follow the instructions
  • Get the software that will fix your PC by clicking here.

    If you are getting error code ms project vba runtime error this blog post should help you. Run-time error “” – Programmatic access to a Visual Basic project is inappropriate (Mac). This error occurs in Office or Office on the Mac version. This error occurs due to the addition of a security surrogate to the Microsoft Office settings.

    I am trying to create an Excel file (Office ) that Microsoft designs into. When I do it manually, it works tiny (to make sure the Excel file is probably not corrupted). However, when I watch it using macros (linked MPP file when run) in MS Project, I get the error ‘Runtime error’ ‘. Below the code I am trying to run from this MSProject.

    I have used Google but found specific solutions for Excel VBA Runtime Calculation Error “” but have nothing to do with MS Project Runtime Error “”

    Are you looking for the “Unable to run macro” problem in Excel? Then you’ve come to the right place. This message is considered one of many that can occur due to runtime error Other variations of error in Excel:

    • Application or Object Error: Runtime Error
    • Object Worksheet Ranger Method Failed
    • Failed to copy worksheet learning method.
    • Programmatic access to a Visual to Basic project is unreliable.
    • Excel Macro Runtime Error
    • Method to open object books failed: runtime error
    • Failed to select Range class method: Excel VBA runtime error
    • Application or Object Error: Savego like VBA runtime error
    • Difference between method and _global object failed center visual: runtime error

    What Is Excel Runtime Error ?

    How do I fix error in VBA?

    Open a very empty workbook in to File> Options> Trust on Trust Center the Macro Options section, ensure that trusted access is enabled for the VBA project object model.

    Microsoft Excel can be a useful and very popular spreadsheet that makes calculating data easy. It is used by both individuals and companies around the world, so it is available in XLS and XLSX formats.

    When working with Excel stock or trying to create a macro, many users are currently facing a more complex runtime error This will help you make changes to the Excel workbook you are having problems with, some crash or crash resource libraries programs, and even into your system. This leads to significant performance issues when working with Visual Applications Basic.

    Runtime error can appear in any version of Excel , from Excel to Excel In most cases, it occurs when you try to run a Microsoft Visual Basic for Applications macro. The issue is caused by good security practices designed to block VBA-Microsoft fromExcel. Runtime error does not occur when granting access to the security privilege. The error can also be related to program corruption, which indicates a malware infection.

    Why Am I Getting Excel Runtime Error ?

    1. Damaged shortcut on the MS Excel desktop.
    2. Copy and paste TV data into MS Office Excel workbook.
    3. Program conflict when opening Excel VBA file.
    4. Set the widths programmatically using a bunch of significant lines.
    5. An error caused by the application or object.

    Whatever the reason, getting rid of the problem is a snap. Deny Reading to learn how to resolve runtime error when making changes in Excel.

    How To Fix New Excel Windows 10 Runtime Error

    The Following Solutions Are Already Proven:

    1. Run antivirus scan.
    2. Allow access to the VBA project object model
    3. Create a new Excel template.
    4. Uninstall Microsoft Works
    5. Remove GWXLXLA

    By the time you try one or more of the aboveabove fixes, the bug is likely to be fixed. However, we will provide you with detailed instructions on how to distribute solutions. 1:

    Patch Perform A Fantastic Malware Scan

    This is the first solution you should try if you encounter a runtime error If your personal system is infected with other types of malware, you will have unpleasant and unexpected fears. Your system and application will not work as expected. Important files and documents can also become dangerous.

    What does Error Code mean?

    When trying to update or repair a working iPhone, you may receive error in iTunes. This error means Apple iTunes cannot connect to all servers that are required to update or restore iPhone.

    Run a complete scanning system with powerful antivirus. We recommend that you use an antivirus
    ms project vba runtime error

    Beyond logic. This software tool has precise tools to detect and even eliminate elusive malicious elements that your existing antivirus might be overlooking. Auslogics is Microsoft’s preferred partner. You are a Microsoft Silver Certified Application Developer. Auslogics products are validated by experts trusted by millions of users around the world.

    Allow Access The Object Model Of The Revised VBA Project

    The answer is simple. Just follow these simple steps:

    1. Start Excel and go to the File tab.
    2. Click Options.
    3. Click Trust Center. This is the last option for exiting the window.
    4. In the most efficient area, click the Trust Center Settings button.
    5. On the new page that opens, go to the macro settings in the left pane and click on it.
    6. It is common to check “Trusted access to the VBA project object model” in the settings of the “Developer macro” section of the fantastic section.
    7. Click OK.

    Fixed Many Creations: New Excel Template

    Instead of cloning or duplicating an existing sheet, most users can insert a new Excel sheet file into the template. This fixes the runtime error Here’s how to do it:

    1. Start Excel.
    2. Press Ctrl + N on your keyboard to open a new book. It is unambiguous to do only one sheet of the book on location. Delete the rest.
    3. Change the bookaccording to your needs on the go.
    4. Save the book by pressing Ctrl + S on your keyboard. Or, if you are using Excel , click the file bracket and click the Save As button. For Excel and later, click the appropriate Microsoft Office icon in the upper left corner of the screen, and then click Save As.
    5. Select the option to save the file to the entire computer and enter a suitable name for the file.
    6. Click the drop-down arrow next to Save As Type and select Excel Template (.xlt) if you typically use Excel If you select Excel and later, select Excel Template (.xltx) instead.
    7. After saving the main model, paste the discount code as follows:

    ms project vba runtime error

    Be sure to replace “path filename” with the actual path and fully qualified model name.

    Fix 4: Uninstall Microsoft Works

    1. Right-click on “Start Important” to open the Power User Plan. Usually choose Task Manager from the list. Otherwise, press Ctrl + Alt + Del on a trusted keyboard, then click Task Manager.
    2. Click any of the running applications in the task manager, and then simply click the “End task” button.
    3. Close the Task Manager window.
    4. Open the Run utility by pressing Windows Laptop + R. Type “” (without quotes) in the text box and click OK or press Enter on your keyboard.
    5. Find Microsoft Works in the entire list of applications and right-click it. Then click “Delete” in the context menu. Confirm your hobby when prompted.

    Fix 5. Remove GWXLXLA


    1. Press this Windows + E combination on your keyboard to open File Explorer.
    2. Go to my path: C: Users >> personal name> AppData> Local> MicrosoftExcel.
    3. Open the XLStart folder.
    4. Find and delete the GWXLaXLA file.



    If your PC is running slow, littered with errors, and prone to crashing, it's time for ASR Pro. This powerful software can quickly fix Windows-related issues, optimize your system performance, and keep your data safe from harm. With ASR Pro, you'll enjoy a faster, more stable PC experience - without the hassle and expense of taking it in for repair. So don't wait - download ASR Pro today!

  • Step 1: Download and install the software
  • Step 2: Open it and click on the "Restore" button
  • Step 3: Select the backup you want to restore from and follow the instructions

  • We hope the above solutions helped you fix runtime error near Microsoft Excel and get the record back to your file. There are many problems that can lead to a runtime error. However, when you get to the end of this guide, you should be fine.

    Feel free to stayPut your numerous questions or comments in the appropriate section. It is good that we have heard from you.

    Protect your computer from threats with antivirus software

    Check someone else’s computer for malware that may not be present in your malware and carefully remove threats with Auslogics Anti-Malware


    3 votes, Medium: s 5

    Get the software that will fix your PC by clicking here.

    VBA Error

    Automation error (Error )

    What does 'Error Programmatic access to Visual Basic Project is not trusted' mean?

    Modified on: Jun 17,

    This article is for users of:

    This error is caused by a security option in Excel meant to deliberately lock out programmatic access to Microsoft Visual Basic for Applications (VBA) unless a user chooses to permit such access.

    To resolve:

    1. Open a blank workbook in Excel.
    2. Go to File > Options > Trust Center
    3. Click on Trust Center Settings 
    4. Under Macro Settings, make sure Trust access to the VBA project object model is checked. 

    Article views count
    VBA Error