Home > Microsoft Excel

VBA runtime error 91

a nice image
By Genesis and SheilaUpdated on June 4th, 2022

What is 'VBA runtime error 91'?

VBA runtime error 91 is an error that usually occurs when attempting to use an application that has issues with the variables within it. Basically, a variable is a container that programmers use to store flexible data. The error may refer to the wrong kind of data stored in a variable or the variable itself is being referenced incorrectly.

Tools used in the development of applications including DCOMCnfg.exe, .NET Framework and Visual Studio have been known to be related to the error.

Other causes for the error may also include malicious files, viruses, and the incomplete installation of a Windows operating system.

How can you fix 'VBA runtime error 91'?

Some of the common fixes include:

  • Configuring DCOMCnfg.exe
  • Doing a Windows Update
  • Installing Microsoft Visual C++Redistributable and .NET Framework
  • Reinstalling the software or application

Please see our in-depth walk-through solutions below.

1. Configure DCOMCnfg.exe

Configure DCOMCnfg.exe
Image Credit: genesismarasigan / ErrorSolutions.tech

Distributed COM might be disabled resulting in "VBA runtime error 91." Enable it to fix the error. See instructions below.

Also, the account you are using might have no permission to do any changes related to Distributed COM. Please log as administrator.

Enable Distributed COM

  1. Open Component Services, click Windows Start then type "DCOMCNFG" and press Enter key.
  2. Expand Component Services >> Computers >> My Computer.
  3. Right-click My Computer and select Properties.
  4. Click Default Properties Tab, and Enable Distributed COM on this computer then press OK.
  5. Optional: To give access to another account, click COM Security tab.
  6. Click Edit Limits, click Everyone or whoever you want to have access to it then check the Allow access and click OK.
  7. Click Edit Default then check the Allow access to both SELF and SYSTEM and then click OK.
  8. Restart your Computer.

Also, some of the DLL might not be registered. See below to register DLLs.

  1. Press Windows key + S key or click Windows Start.
  2. Type "DCOMCNFG" and press Enter key.
  3. Expand Component Services >> Computer >> My Computer.
  4. Then click DCOM Config, if a confirmation appears to register components, click Yes.
    Please confirm it all.
  5. Restart your Computer.

2. Do a Windows Update

"VBA runtime error 91" may also occur when your Windows is not updated. Sometimes, the software requires a specific Windows file from a Windows Update to be able to run. An example is the latest version of Microsoft Visual C++ Redistributable and .Net Framework. See instruction here on YouTube.

Do a Windows Update
Image Credit: genesismarasigan / ErrorSolutions.tech

Restart your PC and do a Windows Update.

For Windows 7

Go to Control Panel ==> System and Security ==> Windows Update ==>Install Updates.

Windows 10

Click Windows Start, type Check for updates and press Enter key.

3. Installing Microsoft Visual C++ Redistributable and .Net Framework

"VBA runtime error 91" could also be due to a missing, corrupt or out of date Microsoft Visual C++ Redistributable and .Net Framework. Try to download the lasted version of the Microsoft Visual C++ Redistributable and .Net Framework. Microsoft Visual C++ Redistributable and .Net Framework will also provide you the DLL you may need to fix the error. See instruction below or watch it here on YouTube.

NOTE: A Windows Update might be required before you can install the latest version of the Microsoft Visual C++ Redistributable and .Net Framework

For Microsoft Visual C++ Redistributable.

Go here.

For Microsoft .Net Framework.

Go to here.

4. Reinstall the Software or Application

Reinstall the Software or Application
Image Credit: genesismarasigan / ErrorSolutions.tech

Incomplete installation of a software or application may also result in “VBA runtime error 91.” The reinstallation of the software may also result in the error due to remnant files, DLL and the registry of the previously installed software. To fix this, uninstall the software and run cleaner to delete remnants and temporary files. See the guide below.

Run Disk Clean Up

Watch it here on YouTube

  1. Click Windows start then type in “Disk Cleanup” and then press Enter key.
  2. Click all checkbox, click Ok button and press Ok for the confirmation.
  3. This will clean all temporary file.

Run CCleaner

NOTE: Download it here.

  1. Run CCleaner.
  2. Click Registry.
  3. Check all checkbox.
  4. Click Scan for Issues. Wait until it is finished.
  5. Click Fix selected issues. Wait until it is finished.
  6. Restart your computer.
  7. Then, install the software or application again.