Error 91 excel

error 91 excel

Hello, When Ever I run my code I get the runtime '91': object variable or with block variable not set. Any help? Dim oXL As Excel. "Run-time error '91': Object variable or With block variable not set" Error When Importing And Uploading Items In PIM Using Excel WebADI. Excel will throw error 91 when calling Activeworkbook.Sheets while having multiple files with the same name open at the same time. This can.

watch the thematic video

VBA Run-time Error '91' Object-variable or With block variable not set

Microsoft Visual Basic: Run-time Error ’91’

Ever encountered the Microsoft Visual Basic error “Run-time Error ’91’: Object variable or With block variable not set” when opening a SOLIDWORKS file? Or if you’re creating a new SOLIDWORKS Macro, and while running it you see this pop up?

Microsoft VB Run-time Error '91'

Microsoft VB Run-time Error ’91’

Lucky for you, this is a very common VB error that’s encountered and it’s not too difficult to determine where the issue lies.

Lets http error 500 php at the steps that one needs to take to resolve this VB error.

  1. Ensure that you have access to the Macro file that is being run within SOLIDWORKS
  2. Launch up the .swp file in Edit mode. This can be done via Tools > Macro > Edit > Browse to the macro location OR through your macro toolbar > Edit > Browse to the macro location
  3. You will see a VBA Editor window, seen in the screenshot below:
    Sample Macro Code

    Sample Macro Code

  4. To identify where the error lies, you would need error 91 excel through the code, error 91 excel. This can be done by placing BREAKPOINTS in the code by selecting the grey section next to the line as seen below.
    Add a breakpoint to the code

    Add a break error 91 excel to the code

  5. Now press the key ‘F8’ on your keyboard to STEP through the code until a line fails and gives you the Error 91 excel Error.
    • Make note of the line number resulting in that error.
  6. The line should begin with a “Set OBJECT = ___________” Statement
    • This indicates that a variable was used without being declared.
  7. To address this issue, declare the OBJECT variable above the Set line using the “Dim OBJECT As SldWorks.OBJECT”
    • Example: the Statement that errors out could be “Set Part = swApp.NewDocument….”
    • The correct declaration for that would be “Dim Part As SldWorks.ModelDoc2”

To ensure that you have the correct object type, reference the SOLIDWORKS API Web Help for detailed information on the various commands and enumerations available.

Learn more about SOLIDWORKS Macros/API

Javelin provides SOLIDWORKS VB for Applications and SOLIDWORKS API training courses, which you can take live online, or in one of our Canadian classrooms. Check our schedule to learn more.


This blog contains the detail about Excel runtime error 91:Object Variable not Set. Check out the complete detail hp m2727 error 49 this specific error code and go through the complete fixes to learn how to fix Excel error 91.

I have outlined the list of all the fixes, in the below section of this post.

What Is Excel Runtime Error 91?

Excel runtime error 91 has a chance to occur in all Windows versions. The main culprit behind this error is DCOMCnfg.exe file.

The main purpose of this file is to set the security settings as per system-wide and corruption of this leads to generating such type of error.

Error Detail:

Error code: Run-time Error 91

Description: Object Variable or With Block Variable not Set


Object Variable or With Block Variable not Set

What Causes Object Variable Not Set Error 91 In Excel?

Check out the following causes to fix object variable not set error 91 in Excel, error 91 excel.

Mostly this error encounters in VB applications. It originates due to the use of the wrong code error 91 excel the Excel macros VBA editor. All in all this error message is clear indication that your excel VBA code has a variable which is not initialized properly.

One very obvious reason to encounter Object Variable Not Set Error 91 is corruption of ‘DCOMCnfg.exe’ file.

Well behind the corruption of this ‘DCOMCnfg.exe’ file following causes are highly responsible.

  • The issue with the operating system.
  • MS Excel application is rendering some issue which leads to crashing or corruption of the file.
  • A virus or bug is present on the PC and this results in corruption of the file.
  • Sudden power failure leads to unexpected closing of the database and this leads to corruption of exe file.

How To Fix Excel Runtime Error 91: Object Variable Not Set ?

1. Disable Script Debugging

Using the service Machine Debug Manager you can easily disable the Script debugging, error 91 excel. The easiest way to handle this is by using Internet Explorer.

Go to the Start menu and in the search box error 91 excel internet options and tap the first appearing option, error 91 excel. From the opened internet options go to the Advanced Tab.

Scroll down to the browsing options and tap to the Disable Script Debugging (other) and Disable Script Debugging (Internet Explorer).

This Runtime error 91 can occur in varieties of application program in which update is needed from the developer side.

2. Change DCOMCnfg.exe Settings

The main reason behind Excel error 91 is the way through which DCOMCnfg.exe restricts permission on certain programs and files.

DCOMCnfg.exe program file helps your PC to control many aspects of the system. Whether it’s about loading the programs to control file permissions.

Sometimes cases arise where DCOMCnfg.exe file blocks public access for certain types of files.

As a result of which you will start getting Runtime 91 error in Excel. To fix this, you need to load DCOMCnfg.exe on system and then alter the permission from private to the “Everyone”.

3. Clean Out Viruses

Another responsible reason behind excel error 91 can be virus mercedes w168 start error malware infections. Before this problem elevates and hampers your system data. To avoid this situation install a good spyware or antivirus application with all the latest updates after making a complete scan.

4. Check Windows For Latest Updates

Updating the operating system is very important as these updates at the end help you to fix runtime error 91. So make a cross-check whether your Windows or Installed application software has some update or not. It your application has some bug then updating the operating system works superb and very soon you will be able to fix Runtime Error 91.

To check for the latest updates hit the Settings -> update & security -> windows update -> check for the updates.

Go With The Recommended Option:

If none of the aforementioned solutions works in your case then also you need not to get tensed as there are still some options left. As, you can try the expert’s recommended Excel data recovery software. This software is well compatible with Windows OS. No matter in what circumstances you have lost your Word file data, using this tool you can easily overcome this data error 91 excel situation.


Wrap Up:

So these are some best fixes to resolve run time error 91so try it and do share your experiences with us.

If you have any query or suggestions to share regarding this Excel runtime error 91 then feel free to comment below.

"Run-time error '91': Object variable or With block variable not set" Error When Importing And Uploading Items In PIM Using Excel Error 91 excel

My Oracle Support Banner

Last updated on MARCH 28, error 91 excel, 2022

Applies to:

Oracle Product Hub - Version 12.1.3 and later
Information in this document applies to any platform.


When attempting to import and upload items in PIM,
the following error occurs.

Run-time error '91':
Object variable or With block variable not set

The issue can be reproduced at will with the following steps:
Using the functionality Batch Import > “Import from Excel”
1) Select Object > Item and click on continue
2) Select ICC and system default format for importing the data
3) Click on Import in error 91 excel screen and choose Excel 2007
4) Download the Excel sheet on desktop
5) Enable Editing
System shows Run time Error



To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

Oracle offers a comprehensive and fully integrated stack of cloud applications and platform services. For more information about Oracle (NYSE:ORCL), visit
� Oracle Legal Notices

I have a Run Time Error 91 for an Excel Add In

Your comment on this question:

1 answer to this question.

Your answer

Your error 91 excel on this answer:

Related Questions In Database

Subscribe to our Newsletter, error 91 excel, and get personalized recommendations.

Already have an account? Sign in.

webinar_successThank you for registeringJoin Edureka Meetup community for 100+ Free Webinars each monthJOIN MEETUP GROUP
Communities error 91 excel


Leave a Comment