How to Troubleshoot Runtime Error 91 on Windows PC



Updated November 2024: Stop getting error messages and slow down your system with our optimization tool. Get it now at this link

  1. Download and install the repair tool here.
  2. Let it scan your computer.
  3. The tool will then repair your computer.

Have you encountered the Microsoft Visual Basic error “Runtime error ’91’: Object variable or With block variable not set” when you open a SOLIDWORKS file? Or when you create a new SOLIDWORKS macro and see that message appear when you run it?

Fortunately for you, this is a very common VB error, and it’s not very difficult to determine where the problem lies.

What causes runtime errors 91?

The reason why the pop-up window with the message “Runtime Error 91: Object variable or with block variable not set” appears is because the DCOMCnfg.exe file may be corrupted. The DCOMCnfg.exe file is commonly used to configure permissions and set security settings on a system. If there is a problem with this file, your system will not be able to load the files needed to start up, and a runtime error 91 will be displayed.

To fix this runtime error, we have found some very effective methods. We will present them one by one, with a detailed description of the steps. You can apply these methods and try to solve the problem yourself.

How to fix runtime error 91?

November 2024 Update:

You can now prevent PC problems by using this tool, such as protecting you against file loss and malware. Additionally, it is a great way to optimize your computer for maximum performance. The program fixes common errors that might occur on Windows systems with ease - no need for hours of troubleshooting when you have the perfect solution at your fingertips:

  • Step 1 : Download PC Repair & Optimizer Tool (Windows 10, 8, 7, XP, Vista – Microsoft Gold Certified).
  • Step 2 : Click “Start Scan” to find Windows registry issues that could be causing PC problems.
  • Step 3 : Click “Repair All” to fix all issues.

Download Now


Updating Windows

The runtime error 91 may be related to the .NET Framework and Visual Basic, for which updates are applied through Windows Updates. Therefore, make sure that your Windows is up to date:

  1. Right-click the Start button and select Settings.
  2. Select Update and Security
  3. Click Check for updates.
  4. Wait for Windows to download and install any necessary updates.
  5. Restart your computer

Reinstall the problem application

  1. Type Control Panel in the Windows search box and press Enter.
  2. Go to Programs -> Uninstall Application
  3. Select the application from the list, right-click and select Uninstall.
  4. Then reinstall the application.

Specify that DCOMCnfg.exe can be run by “anyone”

  1. Type DCOMCnfg.exe in the Windows search box and press Enter.
  2. In the Component Services window, expand the following items: Component Services -> Computer -> My Computer
  3. Right-click My Computer and select Properties
  4. Select the COM Security tab and under Access Permissions, select Edit Limits.
  5. Select Everyone in Groups and make sure that Local Access and Remote Access are set to Allow.

Scan your computer for malware

  1. Click the arrow on the taskbar and double-click the Windows Security icon.
  2. Select Protect Against Viruses and Threats.
  3. Select the scan options under the Quick Scan button
  4. Select the Full Scan option and click the Scan Now button.



Expert Tip: This repair tool scans the repositories and replaces corrupt or missing files if none of these methods have worked. It works well in most cases where the problem is due to system corruption. This tool will also optimize your system to maximize performance. It can be downloaded by Clicking Here

Frequently Asked Questions

  1. In Windows search, type Control Panel and press Enter.
  2. Go to Programs -> Uninstall a program.
  3. Select the application in the list, right-click on it, and select Uninstall Reinstall the problem application.
  4. Then reinstall the application and see if that fixes error 91.

VBA Runtime Error 91 is a common error that occurs during VBA development. This error occurs when you try to use an object variable (i.e., an "object" type variable) that is not (correctly) assigned an object.

Runtime errors are errors that occur after the code has been compiled and executed. This is code that looks correct because it has no syntax errors, but cannot be executed. For example, you might write a line of code to open a file correctly.

Scroll to Top