Spreadsheet Planet

VBA Runtime Error 91 – How to Fix?

VBA runtime error 91, also known as “Object variable or With block variable not set,” is a common error in VBA.

Runtime Error 91 in VBA

This tutorial discusses six typical causes of the VBA runtime error 91 and possible solutions.

Table of Contents

What is Runtime Error 91 in Excel VBA?

Runtime Error 91 in Excel VBA is known as the “Object Variable or With Block Variable Not Set” error.

The VBA Runtime Error 91 typically occurs when an “Object variable not set” error is encountered in the code. This means that the code is referring to an object that hasn’t been properly defined or initialized.

In VBA, object variables (like a Worksheet, Range, etc.) require the Set keyword before they can be assigned. So, if you forget to do this, you will come across this error.

Here’s an example:

To fix the error, you just need to add the Set keyword when assigning the object variable (as shown in the code below):

Runtime Error 91 in Excel VBA is commonly triggered by the following scenarios:

  • Uninitialized Object Variable : When you declare an object variable but forget to initialize it with the Set keyword.
  • Invalid Object Reference : Trying to reference an object that doesn’t exist or is out of scope.
  • Late Binding Failure : When you attempt to access properties or methods of an object variable that hasn’t been fully qualified.
  • Null Object References : Trying to manipulate an object that has been set to Nothing.
  • Collection Items Not Found : Attempting to access an item in a collection that doesn’t exist, like referencing a nonexistent Worksheet by name.
  • Disconnected Recordset : In the context of databases, trying to manipulate a DAO or ADO Recordset that is either closed or not properly connected.
  • Broken Links in Excel : In some cases, a broken link to an external workbook or add-in might trigger this error.

How to Fix VBA Runtime Error 91?

Now that you know what the VBA runtime error 91 is, let’s go through some examples of where you get this error and how to fix it.

Cause #1: Not Using the ‘Set’ Keyword to Assign Object Reference to Variable

The most common cause of the Excel VBA runtime error 91 is not using the “Set” keyword to assign an object reference to an object variable.

The following example code will result in the runtime error 91:

The error occurs because, in the third code line, we have assigned the “ActiveSheet” object reference to the “ws” variable without using the “Set” keyword.

How to Fix?

The correct assignment statement in this example should be “ Set ws = ActiveSheet ” as seen in the corrected code below:

We use the “Set” keyword to assign object references to object variables because it is essential for distinguishing between object and non-object variables.

Cause #2: Attempting to Use an Object Variable that is Not Initialized

An object variable is a variable that contains a reference to an object. If you attempt to use an object variable in your code that is not referencing a valid object, VBA will throw the runtime error 91.

For instance, if we execute the following example code, we get the runtime error 91.

The error happens because we are trying to change the name of the ws variable, but we have not specified what this object is. 

Initialize  the “ws” object variable using the “Set” keyword as in the code below:

The “ws” object variable is set in the second line of the code, and now we get no runtime error 91 when we run the code. It renames the active sheet to ‘Test2’

Cause #3: Attempting to Use an Object Variable that Has Been Set to Nothing

When you set an object variable to “Nothing,” it effectively releases the reference to the object. This nullification means that the variable no longer points to any specific object. 

Any subsequent attempts to use the object variable set to “Nothing” will result in an “Object variable or With block variable not set” error.

Let’s consider the following example code:

When we run the code, the code halts at code line 7 and displays the error message “Run-time error ’91’: Object variable or With block variable not set.”

VBA Debug showing line causing rumtime error 91

The runtime error 91 occurs because the “ws” worksheet object variable has been set to “Nothing,” causing VBA to be unable to determine which particular worksheet to rename.

If you inadvertently set the object variable to “Nothing,” you can remove the entire “Set” statement. 

Otherwise, you must assign a new reference for the object variable. To do this, you can use a new “Set” statement to establish a new reference to the object, as in the corrected code below:

Cause #4: Specifying a Line Inside the ‘With’ Block When Choosing Set Next Statement Command

If we are debugging code and we set a breakpoint on the line assigning an object reference to an object variable as in the screenshot below and run the code:

Set break point in the VBA code

The code will halt at the breakpoint. If we then click inside any line inside the ‘With’ block, press Ctrl + F9 to set it as the next statement, as in the example below:

Click on a line to set it as next statement

If we rerun the code, VBA will throw a runtime error 91. 

The error in this code occurs because the line that assigns the “ActiveSheet” worksheet object reference to the “ws” object variable is skipped, and the code attempts to enter a value in cell “A1.” VBA cannot determine which worksheet contains cell “A1” to enter the value, leading to the runtime error 91.

About the Set Next Statement Command

The “Set Next Statement” command in VBA allows you to select a line of code before or after the current statement. 

When you rerun the code, any intervening code isn’t executed. 

You can access the “Set Next Statement” command by clicking on “Debug” and selecting “Set Next Statement” or by using the keyboard shortcut Ctrl+F9.

Click on Set new statement

Set a breakpoint on the entry point of the ‘With’ block to ensure that the ‘With’ block is initialized by executing the ‘With’ statement.

Cause #5: The ‘GoTo’ Statement Jumps to a Line Inside a ‘With’ Block

If the target of a ‘GoTo’ statement is inside a ‘With’ block, the runtime error 91 can occur. 

Consider the example VBA code below:

In line 5 of the code, the ‘GoTo’ statement directs the program to jump to “Header1” when the z value exceeds 10. This jumping causes the ‘With’ statement in line 9 to be skipped, and the code jumps directly to line 11. 

However, since the entry of the ‘With’ block has yet to be initialized, the attempt to enter the value z into cell A1 on line 11 results in the runtime error 91.

Excel VBA cannot determine which object the “Value” property on line 11 refers to due to skipping the ‘With’ statement on line 9, triggering the runtime error 91.

Ensure  ‘GoTo’ statements in your code never jump directly inside a ‘With’ block .

Note: In structured programming, using the ‘GoTo’ statement is discouraged as it makes code difficult to read and maintain. The ‘GoTo’ statement should only be used when necessary.

Cause #6: Attempting to Use Object(s)Not Yet Created During Runtime

Sometimes, the runtime Error 91 occurs when we try to use objects that have not been created yet during code execution. Here are three examples:

Example #1: When Using Dictionaries

A dictionary is a data structure used to store and manage key-value pairs. When we declare a dictionary object and add values to it without first creating a new instance of the object, we get a runtime error 91.

Let’s consider the following below VBA code:

When we execute the code, we encounter the runtime error 91 because we are attempting to use a dictionary object that has yet to be created.

After declaring the dictionary object, we must add a statement that creates a new instance of the object during runtime and assign it to the object variable as in the code below:

Example #2: When Using Collections

A collection is a data structure that stores and manages a group of related objects such as worksheets, charts, and cells.

When we declare a collection object and add objects to it without first creating a new instance of the object, we get a runtime error 91.

Let’s examine the following VBA code:

When we execute the code, we encounter the runtime error 91 because we are attempting to use a collection object that has yet to be created.

After declaring the collection object, we must add a statement that creates a new instance of the object during runtime and assign it to the object variable as in the code below:

Example #3: When Creating a New Outlook Mail Item

Microsoft Outlook is a popular personal information management (PIM) software application known for its email client capabilities.

If we do not correctly declare and set the Outlook Application object and the Outlook Mail Item object in Excel VBA, attempting to create an Outlook mail item will result in a runtime error 91.

Let’s consider the following code:

When we execute the code, we encounter the runtime error 91 because we are attempting to use an  Outlook Mail Item object that still needs to be created.

After declaring the Outlook Application object and the Outlook Mail Item object, we must add statements  that create a new instance of the Outlook Application object and a new Outlook Mail Item object  during runtime and assign them to the relevant object variables as in the code below:

Note: This code will only work if Outlook is correctly configured on your device.

Dealing With VBA Runtime Error 91 Using Error Handling

We recommend you implement error handling in your code to gracefully handle situations where an object might not be available or initialized. 

You can, for instance, use ‘On Error Resume Next’ to suppress the error temporarily and then check the object for ‘Nothing.’ 

Here’s an example VBA code that uses error handling to show you a helpful message:

Note: You can also use VBA’s debugging tools to step through your code and see exactly where the error occurs. This process can help you identify the root cause of the issue.

Tips to Avoid the VBA Runtime Error 91

To fix this error, follow these steps:

  • Declare the object variable : Before using any object in VBA, such as Worksheets, you need to declare it. Use the ‘Dim’ keyword followed by the variable name and its type. For instance, to declare a variable to reference a worksheet, write the code:  Dim mySheet As Worksheet .
  • Set the reference to the object : Once the variable is declared, you need to assign a valid reference to the object by using the ‘Set’ keyword. For instance, if you want to reference the first sheet in your Excel workbook, write the code:  Set mySheet = Sheets(1) .
  • Use the object variable : Now that you have set the reference to the object, you can use the variable to reference elements within the object. For example, if you want to access a range in your worksheet, you can write:  mySheet.Range(“A1:B10”).Select .
  • Check for ‘Nothing’ : When working with objects that can return a ‘Nothing’ value (e.g., when using the ‘Find’ method), make sure to verify if the returned value is ‘Nothing’ before using it. For instance, if you’re searching for a specific value within a range, write the code:

By following these steps, you will avoid the VBA Runtime Error 91 in your Excel spreadsheets.

Just remember to always declare your object variables, set their references, and double-check for ‘Nothing’ values when appropriate. This way, you can keep your code clean, efficient, and free from errors.

This article presented six typical causes of the VBA Runtime error 91 and solutions. We hope you found the tutorial helpful. 

Other articles you may also like:

  • What is VBA in Excel?
  • VBA Type Mismatch Error (Error 13)
  • Using Application.EnableEvents in VBA in Excel
  • Macro vs. VBA – What’s the Difference?
  • Count Rows using VBA in Excel
  • Create New Workbook Using VBA in Excel
  • Using Application.GetSaveAsFilename in VBA
  • VBA ByRef Argument Type Mismatch

' src=

Steve Scott

I am a huge fan of Microsoft Excel and love sharing my knowledge through articles and tutorials. I work as a business analyst and use Microsoft Excel extensively in my daily tasks. My aim is to help you unleash the full potential of Excel and become a data-slaying wizard yourself.

Leave a Comment Cancel reply

Save my name, email, and website in this browser for the next time I comment.

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Object variable not set (Error 91)

  • 7 contributors

There are two steps to creating an object variable . First you must declare the object variable. Then you must assign a valid reference to the object variable using the Set statement.

Similarly, a With...End With block must be initialized by executing the With statement entry point. This error has the following causes and solutions:

You attempted to use an object variable that isn't yet referencing a valid object.

Specify or respecify a reference for the object variable. For example, if the Set statement is omitted in the following code, an error would be generated on the reference to MyObject :

You attempted to use an object variable that has been set to Nothing .

Respecify a reference for the object variable. For example, use a new Set statement to set a new reference to the object.

The object is a valid object, but it wasn't set because the object library in which it is described hasn't been selected in the Add References dialog box.

Select the object library in the Add References dialog box.

The target of a GoTo statement is inside a With block.

Don't jump into a With block. Make sure the block is initialized by executing the With statement entry point.

You specified a line inside a With block when you chose the Set Next Statement command.

The With block must be initialized by executing the With statement.

For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

Interested in developing solutions that extend the Office experience across multiple platforms ? Check out the new Office Add-ins model . Office Add-ins have a small footprint compared to VSTO Add-ins and solutions, and you can build them by using almost any web programming technology, such as HTML5, JavaScript, CSS3, and XML.

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.

Was this page helpful?

Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback .

Submit and view feedback for

Additional resources

Software Solutions Online

VBA and VB.Net Tutorials, Education and Programming Services

What is ‘run-time error 91: object variable not set’ and how do you fix it.

VBA run-time error 91 is a common trappable error seen in VBA development. This error is triggered when you try to use an object variable (i.e. a variable which is of the “Object” type) that has no object (properly) assigned to it .

This error is a very common technical error which can often be encountered by beginners and even experienced programmers. Therefore, it is useful that you understand it, learn about how it is triggered, and how to work around it. This knowledge will help you in your development as a programmer in Microsoft Office.

run-time error 91 object variable or with block variable not set

Key Concept Before We Start — Value Assignment to Variables in VBA

Before we look into the topic of Error 91, let’s go through a very important coding concept in VBA about value assignment to variables. There are two main types of value assignment, which you can think of as (1) “object” and (2) “non-object”. You can see in the table below that for all variables which are non-objects, we simply use “ = ” to assign values to them. However, for object variables , we must always begin the assignment with “Set “.

Normal (Non-Objects)Any variable type that is not an object, e.g. integer, long, string, variate, etc. Set MyVariable = YourValue  
Example:
ObjectsAll variables which are objects. e.g. , application, , etc.

Example 1:
 
Example 2:
 

You can now see why Error 91 is called “Object variable not Set”.  It is because you should assign an object to an object variable with the SET statement .

So How is Error 91 Triggered?

There are four main reasons you might encounter this error:

  • “Set” is omitted in the assignment of an object variable
  • Using GoTo to jump into a “With” block
  • Attempting to use an object variable that has been set to  Nothing .
  • Attempting to use an object which is not yet being created

Scenario 1: “Set” is Omitted in the Reference to an Object Variable

The macro “example1” below shows the most straightforward scenario when Error 91 can be triggered. The variable “ MyObject ” is an object variable. In line 4, “ MyObject = ActiveSheet ” attempts to assign a worksheet object (the ActiveSheet) to MyObject . Because the SET statement was omitted, this line of code causes Error 91 during run time.

To avoid making this mistake, you must always remember to use a Set statement to assign an object to an object variable.

See the correct way of object variable assignment with a Set statement in line 4 below:

Scenario 2: Using GoTo to Jump into a “With” Block

If a GoTo statement jumps into a With block, it may cause Error 91. See the example below:

In line 6, the GoTo statement jumps to “jumper1” when x>5. The With statement in line 10 is bypassed and the process jumps straight to line 12 which is supposed to put the value of x into cell A1. Error 91 will be trigger right there.

Having the With statement (line 10) bypassed, Excel has no idea what object the “Value” property (line 12) refers to, and therefore has no idea where to place the value of x.

To avoid this mistake, make sure your GoTo statements never jump directly inside a WITH block.

Scenario 3: Attempting to Use an Object Variable that Has Been Set to Nothing.

Error 91 can also be triggered when the code attempts to use an object variable that has been set to “Nothing”. (i.e. the object variable has been reset/erased.)

In line 5 of the macro below, the object variable “ MyObject ” has been reset by the statement “ Set MyObject = Nothing “. Error 91 will happen in line 6 (when the code tries to display the name of MyObject in a Msgbox). This is equivalent to having an blank object variable which has nothing assigned to it.

After resetting an object variable by setting it to nothing, make sure you re-assign an object to it (with a Set statement) before calling it.

Scenario 4: Attempting to Use an Object which Is Not Yet Created During Run-Time

The previous examples showed Error 91 scenarios in which objects have not been properly assigned to object variables. There are situations where Error 91 is triggered because the object has not been created.

This scenario normally applies to objects which are not under any of the Microsoft Office Application objects. For instance, (1) generic Visual Basic objects (such as Collection, Dictionary ) or (2) Objects in libraries added through “Add Reference”.

Example (part 1):

The two macros below “ ex4_Collection ” and “ ex4_Dictionary ” contain very typical mistakes made by VBA programmers when using Collections and Dictionaries. In line 2 of both macros, the objects were declared, and then values are being added to the Collection/Dictionary in line 3, where Error 91 occurred.

To fix the macro, you need to learn the syntax to create a new instance of the object.  See below how the two macros are fixed by inserted a new Set statement in line 3 of both macros.

Example (part 2):

Here is another very common case when a reference to a library is added. For example, the Office library is added through “Add Reference” from the Tools menu in VB Editor:

add office object library via references

The macro below tries to create a Mail item. But Error 91 will be triggered in line 3. The macro seems perfectly fine, where the Outlook application object and the MailItem object have been declared, and then a Set statement is used to create a Mail item. But why there is still the Error 91?

The macro below shows the correct approach to create such an (early binding) instance of the Outlook application object. See how line 3 has been added?

The skills to interact with object variables is crucial in VBA development and successful declaration and assignment are the first steps. Understanding the above scenarios can for sure help you program more efficiently in VBA.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • How to Block Adult Sites and Porn Content
  • How to block adult sites
  • How to Block a Website: Step-by-Step Instructions
  • How to Block Porn on Your Computer
  • How to Block Porn Sites

Guide Subject

How to Fix Runtime Error 91: Object Variable Not Set

In the world of programming, encountering errors is inevitable. One common error that developers often come across is  runtime error 91 , which states “Object variable or With block variable not set.” This error can be frustrating to deal with, but fear not! In this article, we will explore what causes this error and provide you with some simple yet effective methods to fix it.

Table of Contents

Understanding Runtime Error 91

When you see  runtime error 91  in your code, it means that a variable is being used without being explicitly set to any object. This typically happens when you try to access an object that hasn’t been initialized or is set to  Nothing . Without properly setting the object variable, your code will throw this error.

Common Causes of Runtime Error 91

There are several reasons why you might encounter  runtime error 91  in your code. Some common causes include:

  • Forgetting to  Set  an object variable before using it
  • Trying to access an object that does not exist
  • Incorrectly referencing objects in your code

How to Fix Runtime Error 91

Now that you understand what causes  runtime error 91 , let’s dive into some practical ways to fix it:

  • Initialize the Object Variable : Before using an object variable in your code, make sure to properly initialize it. Use the  Set  keyword to assign a valid object to the variable.
  • Check for  Nothing : Verify that the object variable is not set to  Nothing  before accessing its properties or methods. If it is  Nothing , initialize it before proceeding.
  • Ensure Object Existence : Double-check that the object you are trying to access actually exists in the context of your code. If the object is not initialized or has been set to  Nothing , you will encounter  runtime error 91 . By following these simple steps, you can effectively resolve  runtime error 91  and prevent it from disrupting your code execution. Remember, paying attention to proper object variable handling is key to avoiding such errors.

In conclusion,  runtime error 91  can be a nuisance for developers, but with the right approach, it can be easily fixed. By understanding the root cause of the error and implementing the necessary precautions in your code, you can ensure a smoother coding experience. Next time you encounter  runtime error 91 , refer back to this article for guidance on how to address it effectively.

  • How to Fix Error Code hcnetsdk.dll 91
  • How to Fix Error Code 92 Chevrolet Cruze

You May Also Like

How to borrow money from dave app, how to watch full movies for free on tiktok, whatsapp this is how you can use whatsapp from your landline, leave a reply cancel reply.

Your email address will not be published. Required fields are marked *

Save my name, email, and website in this browser for the next time I comment.

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

VBA Macro: run-time error 91 - Object Variable or With Block Variable Not set

I keep getting a run-time error of 91 which I searched up and it seems as if it's an issue of whether or not I set/declared my variables/objects properly. I'm pretty sure I referenced everything properly, and the same macro was working earlier... But then all of a sudden the vba macro broke. Any clues as to why this is the case?

Note: There are 2 separate workbooks. 1 workbook acts as a database for clients, and one workbook is a templated sheet where I can search for a client, and it autopopulates the templated sheet.

The error is found when assigning the variable LastRow with a value. I tried using Set in front, but it still didn't seem to work.
  • microsoft-excel

TheRoadLessTaken's user avatar

  • Maybe there is no such worksheet? Or the .Open command failed, and ClientDBWB is undefined? –  Aganju Commented May 26, 2021 at 20:27
  • Which line of code is showing the error? –  Reddy Lutonadio Commented May 26, 2021 at 20:35
  • The debugger highlights "LastRow = ClientDBWB.Sheets("ClientDB").Cells(Rows.Count, "A").End(xlUp).Row + 1" as the error. @Reddy I made sure the path names were correct and I did a check to see if ClientDBWB returned something, and it did. –  TheRoadLessTaken Commented May 26, 2021 at 20:36
  • Edit: It started working again, but I didn't really change anything??? –  TheRoadLessTaken Commented May 26, 2021 at 20:45
  • You can check the object before attempting to use it: If ClientDBWB Is Nothing . –  Yorik Commented May 26, 2021 at 20:52

2 Answers 2

If you used SET in front of LastRow then you missed the syntax of VBA. Aus you declared LastRow to be a Long, assignments can only done using the "="-operator.

On the other hand ClientDBWB is an object where you have to use SET command. Use the debugger to see the different outcome when using SET and when missing it.

Use "option explicit" to enforce you to think about what type of objects you are handling as you have to declare everything.

Another issue I saw is that:

strClient = CurrWkbk.Sheets("House").Range("C11:J11").Cells(1, 1).Value

is a more complicated way to write:

strClient = CurrWkbk.Sheets("House").Range("C11").value

strClient = CurrWkbk.Sheets("House").Range("C11")

r2d3's user avatar

Copy by Assignment

VBasic2008's user avatar

You must log in to answer this question.

Not the answer you're looking for browse other questions tagged microsoft-excel vba macros ..

  • Featured on Meta
  • Announcing a change to the data-dump process
  • Upcoming initiatives on Stack Overflow and across the Stack Exchange network...
  • We spent a sprint addressing your requests — here’s how it went

Hot Network Questions

  • Rambam’s ancient writing spilled on by coffee
  • Elementary divisors theorem is wrong
  • How can I condense my bash script to look for 42 extensions in a directory
  • An arrangement of hyperplanes
  • Does darkvision work underwater? How?
  • Cost of Living/Salary: Sweden vs Germany
  • Can a website serve only a subset of glyphs from a font, instead of the entire a font, on loading?
  • Had there ever been a plane crash caused by flying too high and exploding?
  • Idiomatic expressions for making sarcastic comparisons with other person: translations for ‘otra que’ or ‘ser un poroto’
  • How to color a cell in easytable
  • Maroczy Defence question on f6
  • Is this an invitation to submit or a polite rejection?
  • Counting a class of backtracking walks
  • Is evolution anti-entropic?
  • Eradication of Free Will under a functioning Biblical legal system or Talmudic education
  • I want to number two formula in equation, aligned and split environment
  • What is a proper word for (almost) identical products?
  • Unitary Transformation for QFT with 2 base states is giving the columns in the wrong order
  • Draw a Regular Reuleaux Polygon
  • What is the difference between "Donald Trump just got shot at!" and "Donald Trump just got shot!"?
  • What am I doing wrong if people repeat their original offers and requests despite me declining them?
  • I feel guilty about past behavior in my college
  • Fantasy book(s) with magic powers gained from rose gold rings
  • Measuring vs gate - what is the relation?

how to solve error 91

Windows Report

  • Troubleshooting Guides
  • Common Errors
  • Tech Tutorials
  • Apps & Programs
  • About our team & mission

Runtime Error 91: What Does It Mean & How to Fix It

Give a try to these quick fixes now

updated on October 4, 2023

Share this article

Improve this guide

Read our disclosure page to find out how can you help Windows Report sustain the editorial team Read more

  • Runtime error 91 occurs due to the corrupt DCOMCnfg.exe file and misconfigured security settings.
  • You should disable the Add-ins and re-configure the DCOMCnfg.exe file to get rid of this runtime error.

Runtime Error 91

The Runtime Error 91: Object variable or With block variable not set is a common run time error that occurs on Windows systems. This error is quite puzzling as it pops up randomly in several instances, such as when installing a program, shutting down your PC, or updating Windows to the latest version.

Why do I encounter the runtime error 91 in Windows?

Insufficient permissions on the FRxXMLTag.XML file located in the FRx directory are the primary cause for the run time error 91. Apart from this, other reasons can be:

  • Corrupt system files – Corrupt or misconfigured system files , particularly DCOMCnfg.exe may trigger the mentioned run time error.
  • Incomplete Windows installation – If the Windows upgrade was interrupted for some reason, you will encounter runtime error 91 when attempting to launch apps.
  • Malware and virus infection – Malware and virus attacks mess up your system and cause several system-level problems.
  • App not installed correctly – You can also encounter this runtime error 91 if the app was not correctly installed for several reasons, such as a setup crash.

Interestingly, his guide offers a couple of workarounds to get past this error on your Windows PC.

How can you fix the runtime error 91?

Before we proceed to implement the workarounds listed below, you should perform the following tasks:

  • Restart the computer and launch the software again.
  • Uninstall the app throwing the runtime error, and re-install it again.
  • Uninstall the recently installed Windows update .

If the error persists, try the solutions listed below:

1. Check your PC for viruses and malware

  • Use the Windows + I shortcut to bring up the Settings app.

Runtime Error 91

Viruses and malware can cause a serious blow to your computer, causing runtime error 91 and similar errors. By running a malware scan, you can detect and eradicate any malicious software that may be causing the runtime error.

If you rely on a third-party antivirus , use it to run a full system scan and get rid of the malware and viruses.

2. Configure DCOMCnfg.exe settings

2.1 enable distributed com.

Runtime error 91

  • Right-click My Computer and choose Properties from the context menu.

Runtime error 91

  • Press Apply to save the changes and OK to exit the My Computer Properties window.
  • Devices and Printers is Stuck With Device Setup in Progress Message
  • This Device Cannot be Used Error in ReadyBoost: 3 Quick Fixes
  • Notion Windows App Not Working: 7 Ways to Fix it

2.2 Change permission settings

Runtime error 91

  • Next, press the Edit Limits button under the Launch and Activation Permissions section and edit its permissions settings as well.
  • Press OK to save the changes and restart your computer.

2.3 Register DLLS

Runtime error 91

  • A confirmation popup asking you to register components will appear; click the Yes button.

DCOM (Distributed Component Object Model) is a Microsoft technology that enables software components to communicate on a network.

The DCOMCnfg.exe allows users to configure the settings for DCOM objects, and if misconfigured can give rise to errors like the one at hand. Configuring the DCOM config settings will help you solve the Runtime Error 91 so that your computer can work flawlessly as before.

3. Disable Add-ins

  • Force quit the Microsoft Word app.

Runtime Error 91

  • Click File and choose Options from the left menu.

Runtime Error 91

  • Restart the app and see if the issue is resolved.

Add-ins are additional programs that can be attached to the Microsoft Office applications such as Microsoft Word to enhance its functionality.

These add-ins load along with the Word app, but sometimes they get corrupt and conflict with the app causing runtime time errors. You can disable the add-ins in Word to resolve the runtime error 91 during the app launch.

4. Grant full control to the FRxXMLTag.XML file

  • Log into your computer using the Administrator account .
  • Use the Windows + E shortcut to launch File Explorer and look for the FRx directory .

Runtime Error 91

  • Select System in the Group or user names section, grant Full Control , and press OK to save the changes.

If you encounter the runtime error when generating an error report in XML/Enhanced XML format in Microsoft Business Solutions for Analytics-FRx and FRx Financial Reporter, you should modify the permissions for the FrxXMlTag.XML file.

That’s it! The solutions listed here should have helped fix the runtime error 91 to get things up and running.

If you are looking for fixes to resolve the runtime error code 0x80029c4a , you can refer to this guide.

Which of the solutions above helps you resolve the runtime error 91 in Windows? Let us know in the comments section.

More about the topics: Runtime Errors

Taiba Hasan

A postgraduate in Computer Applications, she is an avid technical writer who loves to craft content revolving around Windows, Android, and emerging technologies like SaaS. With How-To and troubleshooting guides, she aims to provide the best solutions for the problem and make technology less complicated for novice users. Besides writing, she also loves to cook delicacies and spent time in her garden. In her free time, you will find her binge-watching web series or gazing the night sky.

The device setup in progress is stuck in Devices and Printers

Was this page helpful?

Let us know if you managed to solve your tech problem reading this article.

We’re happy to hear that!

You can subscribe to our newsletter to stay up to date with the latest news and best deals!

Do you have a suggestion?

We know how frustrating could be to look for an universal solution.

If you have an error which is not present in the article, or if you know a better solution , please help us to improve this guide.

Trimech-Main-Site-Group-Navigation

  • 877-219-6757
  • 3D Printing Service

The Javelin Blog

Article by Samony Riyaz updated October 5, 2019

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'

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 look at the steps that one needs to take to resolve this VB error.

  • Ensure that you have access to the Macro file that is being run within SOLIDWORKS
  • 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

Sample Macro Code

  • Make note of the line number resulting in that error.
  • This indicates that a variable was used without being declared.
  • 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 .

Related Links

Certified solidworks services available from javelin.

Javelin can help you to:

Posts related to 'Microsoft Visual Basic: Run-time Error ’91’'

Find related content by tag:.

' src=

Samony Riyaz

Get certified training from javelin.

Learn more about SOLIDWORKS Tech Tips with training from Javelin

More Recovery Products

  •   Partition Manager     Partition Master Personal disk manager   Partition Master Enterprise Business disk optimizer   Edition Comparison Partition Master Versions Comparison   Disk Copy Hard drive cloning utility Partition Master Free Partition Master Pro

Centralized Solutions

MSPs Service

Screen Capture

Video Toolkit

Audio Tools

Transfer Products

File Management

iOS Utilities

More Products

  • Support     Support Center Guides, License, Contact   Download Download installer   Chat Support Chat with a Technician   Pre-Sales Inquiry Chat with a Sales Rep   Premium Service Solve fast and more

How to Fix Word Runtime Error 91 in 4 Ways

A runtime error is a common error that usually occurs in Microsoft Office software. It usually happens with different error codes. This time we will focus on runtime error 91. Telling you what is the reason for this error, and how to fix it. Follow the solutions below to solve Word runtime error 91 and repair Word files with simple clicks.

 Trustpilot Rating 4.7

 Secure Download

Table of Contents

how to solve error 91

AI-Enhanced

how to solve error 91

  • Fix videos with different issues, such as broken, unplayable, no sound, etc.
  • Repair corrupted images and enhance their quality with advanced AI algorithms.
  • Fix documents in various formats, including PDF, Word, Excel, and PowerPoint files.

 100% Safe Download

The runtime error is a common error that usually occurs on all versions of Windows-based operating systems, such as Word and Excel. It is not a single error but happens with different error codes, for example, Excel runtime error 1004 and Word runtime error 53 .

Fix 1. Repair Word Documents Download and install EaseUS Fixo Document Repair. From the software's main screen...
Fix 2. Change DCOMCnfg.exe Search DCOMCnfg.exe in the Windows search bar and hit Enter. The Component Services...
Fix 3. Give Full Control Run Windows as administrator. In Windows Explorer browse to the FRx...
Fix 4. Disable Add-ins Close Word, press the Windows and R keys at the same time to open the Run box...

This error is very tricky, as it doesn't describe what problems that cause it and what makes it show up. Fortunately, for Word runtime error 91, there are exact reasons and effective solutions. Keep reading and check for more details.

Word Runtime Error 91

What's the Reason for Word Runtime Error 91

The reason why you would see a pop-up window saying " Runtime Error 91: Object variable or with block variable not set " is that the DCOMCnfg.exe file might be corrupted. The DCOMCnfg.exe file is usually used to configure permissions and set system-wide security settings. When there's a problem with this file, it will prevent your system from being able to load the files it requires to run, and that's when you see the runtime error 91.

We found four effective methods to fix this runtime error. We will introduce them one by one with detailed steps. You can apply these methods to solve the problem yourself.

Fix 1. Repair Damaged Word Documents to Fix Runtime Error 91

Many scenarios can corrupt Word files, such as accidental deletion, app crash, virus attack, unexpected formatting, etc. Whatever the reason, you need a professional file repair tool to repair corrupted Word documents

EaseUS Fixo , all-in-one file repair software, offers full-around solutions to repair corrupted photos, videos, and documents of various types. 

  • Repair corrupted Word .doc and .docx files and recover the complete data, maintaining the original form
  • Fix corrupted Word documents in batches at once
  • Offer advanced repair technologies to repair severely damaged Word files

Now, download EaseUS document repair tool and then use the following steps to recover and repair your Word files.

Step 1. Download and launch Fixo on your PC or laptop. Choose "File Repair" to repair corrupted Office documents, including Word, Excel, PDF, and others. Click "Add Files" to select corrupted documents.

add files to repair documents with Fixo

Step 2. To repair multiple files at once, click the "Repair All" button. If you want to repair a single document, move your pointer to the target file and choose "Repair". You can also preview the documents by clicking the eye icon.

select documents to repair

Step 3. Click "Save" to save a selected document. Select "Save All" to save all the repaired files. Choose "View Repaired" to locate the repaired folder.

save repaired documents in Fixo

Share this useful software on Twitter, ins, Facebook, and LinkedIn to help more people who need to repair broken files.

Fix 2. Change DCOMCnfg.exe Settings to Solve Error 91

As the DCOMCnfg.exe is usually the one to be blamed, the first method we suggest you try is to change its Settings. 

Step 1. Search DCOMCnfg.exe in the Windows search bar and hit Enter.

Step 2. The Component Services window will pop up. Expand the following: Component Services > Computers.

Step 3. You can see the "My Computer" option. Right-click on it and click Properties.

Step 4.  Click the "COM Security" tab, and under Access Permissions, click Edit Limits.

Step 5. Pick Everyone from the groups and make sure that Local and Remote Access is set to Allow.

Change DCOMCnfg.exe Settings

Fix 3. Give Full Control to the FRxXMLTag.XML file

In case the Runtime Error 91 is followed by the Error 5999, you should perform the following steps:

Step 1. Run Windows as administrator.

Step 2. In Windows Explorer browse to the FRx directory.

Step 3. Right-click on the FRxXMLTag.XML file and select Properties.

Step 4. Click the Security tab, add the group Everyone, and select Full Control. Click OK to finish.

Fix 4. Disable Add-ins to Fix Word Runtime Error 91

The third method you can try is to disable the add-ins. The add-in in Word is a program that can be attached to Word to give it additional functionality. An add-in can be thought of as a template that is always loaded when Word is open. So if the add-ins are corrupted, you can also see the runtime error 91. Now, follow the steps below to disable add-ins.

Step 1. Close Word, press the Windows and R keys at the same time to open the Run box.

Step 2. Type winword /safe in the Run box to open Word in Safe Mode.

Step 3. Click "File" > "Options" > "Add-ins". Select "COM Add-ins", and click "Go".

Step 4. Uncheck all the add-ins in the list, and click "OK". Then restart Word.

Disable add-ins

If the Word runs normally, re-enable the add-ins one by one until Word not opening issue happens again. Thus, you may find out which add-in is the culprit.

The Bottom Line

The reason for runtime error 91 varies, but for Word runtime error 91, this article gives you both the causes and the solutions. Try the given solutions, and see if you can fix the issue on your own. What's more, if you are interested in Word recovery, you can download EaseUS Fixo Document Repair!

Was This Page Helpful?

About the Author

author Cedric

Cedric Grantham is a senior editor and data recovery specialist of EaseUS. He mainly writes articles and how-to tips about data recovery on PC and Mac. He has handled 10,000+ data recovery cases and is good at data recovery of NTFS, FAT (FAT32 and ExFAT) file systems, and RAID structure reorganization.

Read full bio

Related Posts

FAT32 Structure Information - MBR, FAT32 Boot Sector

By Tracy King/2024/05/21

What Is Error 0x80070570 and How to Fix It

By Cedric/2024/05/20

Aptio Setup Utility Ultimate Guide | How to Access/Fix It

By Tracy King/2024/05/20

Recover Data After Formatting Laptop/PC in 2024

By Daisy/2024/05/20

how to solve error 91

Copyright ©   EaseUS. All rights reserved.

Success, thanks for submitting!

how to solve error 91

Run-Time Error '91': Object Variable or With Block Variable Not Set, Followed by Error 59999 - Application-defined or Object-defined Error

"Runtime error '91': Object variable or With block variable not set" "Error 59999 - Application-defined or object-defined error"These errors occur when generating a report to XML/Enhanced XML.

Insufficient permissions on the FRxXMLTag.XML file in the FRx directory.

Resolution Log into Windows as an administrative user. Browse to the FRx directory in Windows Explorer. Right-click on the FRxXMLTag.XML file, select Properties, and then click the Security tab. Add the group Everyone, select Full Control, then click OK.

Facebook

Need more help?

Want more options.

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

how to solve error 91

Microsoft 365 subscription benefits

how to solve error 91

Microsoft 365 training

how to solve error 91

Microsoft security

how to solve error 91

Accessibility center

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

how to solve error 91

Ask the Microsoft Community

how to solve error 91

Microsoft Tech Community

how to solve error 91

Windows Insiders

Microsoft 365 Insiders

Was this information helpful?

Thank you for your feedback.

Get IT Solutions

Resolve runtime error 91 – windows 10/11.

Are you finding it difficult to work on Excel or Word because of an error? The runtime error 91 is an error that originates in Microsoft Office and makes it impossible to use it, let alone open it. And if you regularly use Office for your job or university work, the situation becomes difficult, especially since the error is pretty cryptic. So, what causes the word and excel runtime error 91 ? Is there a way out of it? Do you have to go through the installation process again or make a new account? Read on to discover all the answers.  

Table of Contents

What Is the “Runtime Error”?

how to solve error 91

What Causes the “Runtime Error 91” Error?

Like every other runtime error, the word or excel “runtime error 91 : Object variable or with block variable not set” occurs because of a corrupted DCOMCnfg.exe file. Since the .exe file is tasked with giving permissions and opening files, the entire Microsoft Office stops and no programs under it, word, excel, or PowerPoint, open up. 

How to Fix Runtime Error 91?

While the error is pretty annoying, its solutions are quite straightforward. Here’s how you can solve VBA runtime error 91:

Method 1 – Reinstall the Problematic Application

One can run the SFC scan to fix the problems within the system file and eliminate the issue. But what if the file corruption arises from a third-party application and not from default Windows apps? In such a case, even if it is a core app, the SFC scan won’t work. 

The best solution is to uninstall and install the problematic app again. To do so:

  • Open the Control Panel by pressing Win+R and typing control on the pop-up window that appears. You can also search it manually from the Start Menu.
  • From the control panel, navigate to Programs and then Uninstall a program.

how to solve error 91

  • Once uninstalled, install the app and check if the problem persists.

Method 2 – Set Dcomcnfg.exe to Be Allowed to Run by “Everyone”

As discussed, Dcomcnfg.exe remains the biggest culprit behind the runtime error 91. Since the corruption causes the problem, you can change the file’s settings to get rid of it. 

To make the suitable changes:

  • On the Start menu’s search bar, type DCOMCnfg.exe to find and open the file. 
  • Once you open the file, a window titled Component Services will appear. 

how to solve error 91

  • Right-click on My Computer, and from the drop-down menu, select Properties. Another pop-up window appears.
  • On the window, select the COM Security tab.
  • At the top, you’ll see Access Permissions. Click the Edit Limits option under it. 
  • From the Edit Limits window, enter Everyone and ensure that Local and Remote Access have the boxes checked against Allow. 
  • Once you’ve checked the box, click OK on each window you’ve opened till now. The effect will take place immediately, and your access to excel and word should be restored. 

Method 3 – Give Full Control to the Frxxmltag.xml File

If you’ve noticed that your system’s visual basic runtime error 91 is accompanied by Error 5999, then you should try giving complete control to the Frxxmltag.xml file. Here’s how:

  • Launch Windows and operate it as an administrator. 
  • Open Windows Explorer and navigate to the FRx directory.
  • Inside the directory, find FRxXMLTag.XML and right-click on it. 
  • Select Properties. 
  • From the properties window, go to Security and then Everyone. 
  • Under the Everyone group, choose Full Control.
  • Press OK. The changes should be made, and the error is gone. 

Method 4 – Disable Add-Ins to Fix Word Runtime Error

Undoubtedly, add-ins play an integral role in enhancing Word’s functionality and making it more user-friendly. They are always present as templates to make your work clearer and more manageable. However, sometimes these add-ins are corrupted and can stop Word from functioning correctly, showing visual basic runtime error 91 .

Follow the steps below to disable these add-ins and bring back your Word:

  • First, close all Word windows.
  • Now, launch the Run utility by pressing Win+R together. 

how to solve error 91

  • After it opens, navigate to File, Options, and then Add-ins.
  • Choose COM Add-ins and tap on Go. 

how to solve error 91

  • Restart the application, and hopefully, it should work smoothly.

If the Word application works fine, then the problem must lie with one of the add-ins. Add them one by one and restart the application after each. This will help point out which exact add-in was causing the issue. 

Method 5 – Repair Damaged Word Documents to Fix Error 91

If not the DCOMCnfg.exe file, it can be the corruption of a Word document causing the error. Accidents like partition failure, Operating system crash, random formatting, viruses, etc., can be the premise of Error 91. 

Hence, if you also notice that Word file corruption is causing the problem, you’ll need to download a dedicated repair tool. Several reliable tools are available on the market, and you can take your pick. The best ones are:

  • Wonders hare Repairit
  • Remo Word Repair
  • S2 Recovery Tools

These tools are quite easy to use and have a high success rate. They’ll repair the corrupted files while still maintaining the original format. 

Method 6 – Scan Your Machine for Malware

Malware like bugs and viruses can also be behind the problems occurring in your system. Besides just attacking the operating system, it also corrupts files attached to the applications. Thus, factoring in malware, the vb runtime error 91 can also be caused by viruses. 

To check whether this is true, use a reliable anti-virus (or malware) software for a complete scan of your system. You can either use third-party software available on the market or go for Microsoft Defender. It’ll carry out a full system scan to rule out any possibility of malware presence. 

  • On the bottom right, you’ll spot an upwards arrow called system tray. Open the tray and select the Windows Security icon.
  • From the list of options, choose Virus and threat protection.
  • On the right side panel, there will be a Scan options link below Quick Scan. Click on it, and a new window will appear. 
  • Tap on Full Scan and then Scan now. 
  • If it detects any malware, it’ll report the same back, and you can get rid of it manually. 

Method 7 – Update Windows

The .NET Framework or Visual Basic runtime error 91 can be solved by updating Windows operating system. Since .NET Framework and Visual Basic’s updates are part of the OS update, you’ll only have to update once by:

  • Go to the Start Menu and select Settings.
  • Choose Update & Security and then Check for updates.
  • If there are any pending updates, download and install them.
  • Restart the computer.

And there you have it! We hope you found the answers you were looking for to fix runtime error 91. Microsoft is an essential part of our daily work routine; losing it for even a few hours is a nightmare. So, keep these solutions handy, in case you face this issue again!

Related Articles

Task Scheduler 0x8004131f

Navigation Menu

Search code, repositories, users, issues, pull requests..., provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .

  • Notifications You must be signed in to change notification settings

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.91 does not launch on Catalina or Big Sur due to Fatal error in V8 #219893

@joaomoreno

msimms commented Jul 3, 2024

Does this issue occur when all extensions are disabled?: Yes/No

Steps to Reproduce:

I know this is an old version of Mac OS, but if an OS will no longer be supported then perhaps it shouldn't update automatically. This particular installation is a developer test machine that won't/can't be updated past Catalina.

  • 👍 49 reactions

@VSCodeTriageBot

VSCodeTriageBot commented Jul 3, 2024

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.91.0. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

  • 👎 38 reactions
  • 👀 1 reaction

Sorry, something went wrong.

@pcmanik

pcmanik commented Jul 3, 2024

Same issue on Mac OS Big Sur (11.7.10)

  • 👍 66 reactions
  • 😕 3 reactions

@VSCodeTriageBot

adrianomarquess commented Jul 3, 2024

Up

  • 👍 11 reactions

@lomars

lomars commented Jul 3, 2024 • edited Loading

I have the same issue with Mac OS Catalina with VS Code Version: 1.91. The app crashes on Launch.
I reverted back to VS Code Version: 1.90.

  • 👍 18 reactions

@Ice-Cap

Ice-Cap commented Jul 3, 2024

I have the same issue on Mac OS Big Sur. I had to revert to version 1.90 of VS Code

  • 👍 12 reactions

@mjbvz

deepak1556 commented Jul 3, 2024

Sorry for the breakage, I am currently investigating this issue. There has not been any obvious runtime changes in this update that could trigger this.

Please download and disable updates via till this issue is resolved.

  • 👍 26 reactions
  • 🎉 1 reaction

@britniangela

britniangela commented Jul 4, 2024

I now have two VS apps on my computer after trying to get back to the previous version and now everything is messed up. GitHub isn't finding the project I'm in the middle of working on and I don't know what to do because I'm an online "student" for an online coding workshop.

@roojay520

roojay520 commented Jul 4, 2024 • edited Loading

Same problem Intel macOS Catalina(10.15.7), v1.90.2 works fine.

  • 👍 2 reactions

@kythuatwebso

kythuatwebso commented Jul 4, 2024

Same problem Intel Mac OS Catalina, Rollback again v1.90.2 👎

@emauriciomoreno

emauriciomoreno commented Jul 4, 2024

  • 👍 3 reactions

@artkirienko

artkirienko commented Jul 4, 2024

The app crashes on launch, but you can run this in the terminal:

I reverted back to VS Code Version 1.90

@zipzou

zipzou commented Jul 4, 2024 • edited Loading

The Version 1.90.x is worked!

@zpc7

zpc7 commented Jul 4, 2024 • edited Loading

same issue, mac os version: 11.7.10 big sur

: go the link to download v1.90
Update the setting.json: "update.mode": "none"

@jledgett

jledgett commented Jul 4, 2024

Same issue on iMac with Catalina.

@gjsjohnmurray

gjsjohnmurray commented Jul 4, 2024

maybe get this pinned?

  • 👍 1 reaction

@jackbullen

jackbullen commented Jul 4, 2024

Any ideas why executing scripts/code.sh in commit works fine?

@steveca057

steveca057 commented Jul 4, 2024

Same issue

@sirlluis

sirlluis commented Jul 10, 2024

Same problem with Big Sur 11.7.10 Intel chip, seems work with older versions.

@wy353208214

wy353208214 commented Jul 10, 2024 • edited Loading

Upgrade in two ways, but still can't open:

. i copied it to the application directory and replaced the old version. showed 1.91.0?

@alexkuc

alexkuc commented Jul 10, 2024

Those who downgrade and say it still doesn't open, did you disable auto update of VSCode by any chance? By default, VS Code will auto update so even if launch was with previous version, that might be enough time for VS to download upgrade so next time the version is launched. Here's instructions on .

@tategakibunko

tategakibunko commented Jul 10, 2024

It would be easier to disconnect the wifi before starting the old vscode(1.90.2) and set "update.mode": "none".

wy353208214 commented Jul 10, 2024

i set it to 'manual'

gjsjohnmurray commented Jul 10, 2024

the link you posted is for 1.91.0

Progress towards the release of 1.91.1 can be tracked at

@sourceedition

illustrious-otter commented Jul 10, 2024 • edited Loading

Have 1.91.1 working fine on macos 10.15.7 but as soon as I put upgrade back to auto/start it downgrades itself to 1.91.0 ?

@tonywoode

tonywoode commented Jul 10, 2024

address the issue,

+1 to this working on Catalina 10.15.7

@MyroslavSB

MyroslavSB commented Jul 10, 2024

same issue macOS Big Sur 11.4, rollback to VSCode v1.90 fixed the problem. Also in settings disabled auto update. So far so good.

@gjsjohnmurray

suhee700 commented Jul 10, 2024

Same issue in macOS Big Sur v11.6.5, rollback v1.90( ) and fix.

@RoyTynan

RoyTynan commented Jul 10, 2024 • edited Loading

V1.91 on Intel Mac Book Pro running new install of Big Sur 11.7.10. Not installing
V1.90 installed ok. In Preferences/Settings disabled auto update, it's working

@everm1nd

everm1nd commented Jul 10, 2024

Same here.
VSCode launch output from console:

Version:

Fixed by rollback to:

deepak1556 commented Jul 10, 2024

Locking the issue again till new release is made, we have enough data to be confident that the fix in resolves the issue. I will update here once the build is released. Thanks for your patience.

@microsoft

deepak1556 commented Jul 11, 2024

Fix is now available in latest release

  • 😄 1 reaction
  • 🎉 4 reactions
  • ❤️ 2 reactions
  • 🚀 1 reaction

@douggaming

douggaming commented Jul 12, 2024

Thanks for fixing!

@starball5

starball5 commented Jul 12, 2024

Related on Stack Overflow:

@Doyle4

Doyle4 commented Jul 12, 2024 • edited Loading

1.91 still not working on MacOS Catalina.

EDIT: Didn't spot the update fix, website still shows 1.91, all good this way now.

alexkuc commented Jul 12, 2024 • edited Loading

I am on MacOS Big Sur 11.7.10 and can confirm update fixed it work me ( ).

@peanut996

peanut996 commented Jul 13, 2024 • edited Loading

get same issue

mac catalina on 1.91.0

1.91.1 fixed it. it works.

@hoc081098

hoc081098 commented Jul 14, 2024

1.19.1 works 🌸

@YtachY

YtachY commented Jul 14, 2024

MacOS BigSur v11.7.10

1.91.1 fixed it.
Now vscode works.

No branches or pull requests

@joaomoreno

  • Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers
  • Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand
  • OverflowAI GenAI features for Teams
  • OverflowAPI Train & fine-tune LLMs
  • Labs The future of collective knowledge sharing
  • About the company Visit the blog

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Get early access and see previews of new features.

How to solve error 91 on function return

I'm creating a macro that's linked to TFS queries. At some point, I use a function that refreshes each result sheet, and after that, I'm needing to know the table range, therefore my code looks like this:

Now, when I run it, it's working fine, until it reaches the End Function statement, returning error code 91 (I'm watching over RefreshQuery , which creates the expected range). I can't figure what's making it fail, as it's using the Set statement to assign the object, and I have a Range variable to get the result of the function. Any help will be appreciated. Thanks in advance.

Juan Se's user avatar

  • Have you checked that those values are found, i.e. that lr and lc are actual numbers? –  SJR Commented Oct 9, 2017 at 15:41
  • 1 Also, you'd do well to get rid of the teamQueryRange.Worksheet.Select , teamQueryRange.Select and activeSheet.Select and just change your Set to Set RefreshQuery = teamQueryRange.Cells(lr, lc) or similar. –  CLR Commented Oct 9, 2017 at 15:46
  • @SJR, yes, that's exactly the reason I've set a watch over RefreshQuery , to verify those values are correctly assigned –  Juan Se Commented Oct 9, 2017 at 15:57
  • @CLR Good observation! I just used the code for refreshing the query, and hadn't noticed I wouldn't need those instructions in the end –  Juan Se Commented Oct 9, 2017 at 15:59

Check if teamQueryRange is Nothing, in this case refresh set teamQueryRange.

user7698627's user avatar

  • Verified, it's not Nothing. I also noticed that, before running Set RefreshQuery = teamQueryRange.Cells(lr, lc) , I get a pair of values (lr and lc) for the range, but once assigned, the new range has values (lr+1, lc). Could this explain the error shown? –  Juan Se Commented Oct 19, 2017 at 15:32

Your Answer

Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more

Sign up or log in

Post as a guest.

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy .

Not the answer you're looking for? Browse other questions tagged vba excel or ask your own question .

  • Featured on Meta
  • Upcoming initiatives on Stack Overflow and across the Stack Exchange network...
  • Announcing a change to the data-dump process
  • What makes a homepage useful for logged-in users

Hot Network Questions

  • Are hot air balloons regulated by ATC or can they fly without reporting to ATC?
  • How to ask Mathematica to find the nontrivial (nonzero) solution of a homogeneous system of equations?
  • Type C Schengen Visa - Amsterdam
  • How should I understand "mit" in this sentence?
  • Measuring vs gate - what is the relation?
  • Is observing any day by a Reformed Christian tantamount to keeping ceremonial law?
  • Rambam’s ancient writing spilled on by coffee
  • Does darkvision work underwater? How?
  • Had there ever been a plane crash caused by flying too high and exploding?
  • What is it that Laura is not allowed to do?
  • Counting a class of backtracking walks
  • Has a rocket engine ever been reused by a second/third stage
  • How I can redirect the input from one mic to another mic input?
  • Is removing the frightened condition the same as making a successful saving throw when it comes to immunity from the effect?
  • Did any other country than China buy real estate as a buyer of last resort?
  • What does "Nor our strong sorrow, upon the foot of motion" mean?
  • What is the next layers of defence against cookie stealing if GET parameter is vulnerable to XSS and there is no HttpOnly flag in a website?
  • An arrangement of hyperplanes
  • Fantasy book(s) with magic powers gained from rose gold rings
  • Can a bad paper title hurt you? Can a good one help you?
  • What's the easiest way to prove the Riemann Zeta function has any zeros at all on the critical line?
  • Ignore higher order terms in an expression
  • n-ary definition of monoids and other algebraic structures
  • Different Hodge numbers arising from different holomorphic structures?

how to solve error 91

IMAGES

  1. [SOLVED] VBA Runtime Error 91 Windows Code Issue (100% Working)

    how to solve error 91

  2. How do you solve error 91 in ArcSWAT?

    how to solve error 91

  3. [SOLVED] VBA Runtime Error 91 Windows Code Issue (100% Working)

    how to solve error 91

  4. ¿Cómo solucionar Runtime Error 91 en Windows?

    how to solve error 91

  5. How to Fix Run Time Error 91 on windows 10

    how to solve error 91

  6. Run Time Error 91 in Windows 10 / 11 Resolved Now

    how to solve error 91

VIDEO

  1. TikTok Identity verification under review problem solved

  2. How to Fix UEFI Firmware Settings Missing on Windows 11/10

  3. How to Join Particle Testnet| Particle Airdrop A-Z join process for free|Particle Testnet Airdrop

  4. Sohni dharti new big update

  5. Someone outside of your office informs you of an error your team co-workers worked on this project …

  6. Instagram Sorry There was a problem with your request

COMMENTS

  1. VBA Runtime Error 91

    The code will halt at the breakpoint. If we then click inside any line inside the 'With' block, press Ctrl + F9 to set it as the next statement, as in the example below:

  2. Object variable not set (Error 91)

    Support and feedback. Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.

  3. Excel VBA: How to solve Run-time error '91'?

    Assign the result to a Range and use the .Find() to set the range. If nothing is found, then the Range() would be Nothing:. Sub TestMe() Dim result As Range With Worksheets(1) Set result = .Range("2:2").Find("Something", LookAt:=xlWhole) End With If Not result Is Nothing Then Debug.Print result.Address Else Debug.Print "Something is not on the second row!"

  4. What Is 'Run-time error 91: Object variable not set'? And How Do You

    Variable Type: Scope: VBA syntax / treatment: Normal (Non-Objects) Any variable type that is not an object, e.g. integer, long, string, variate, etc.

  5. Object Variable Not Set ERROR (Run-time error '91')

    Learn what causes Run-time error '91' and how to fix it with one simple word: Set.This video was taken from the longer complete guide video here: https://you...

  6. VBA Run-time Error '91' Object-variable or With block ...

    Grab the Free VBA Quick Reference Guidehttps://www.chrisjterrell.com/excel-vba-quick-reference-guide/There are things that must be done when creating an obje...

  7. How to Fix Runtime Error 91 in Word/Excel/SolidWorks macro ...

    This is a complete guide that helps fix Runtime Error 91 (aka, "Run-time error '91'. Object variable or With block variable not set ") on your own system or ...

  8. How to Fix Runtime Error 91: Object Variable Not Set

    In the world of programming, encountering errors is inevitable. One common error that developers often come across is runtime error 91,

  9. VBA Error

    Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of violence, or harm to another.

  10. microsoft excel

    Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site

  11. Microsoft Excel 2010

    From the workbook, press Alt+F11 to activate the Visual Basic Editor. Select Tools > References... The selected references are listed at the top; their check boxes are ticked. If one or more of these starts with MISSING:, do the following: Note their name (s). Clear their check box (es). Click OK. See if the macros now run correctly. If not:

  12. Runtime Error 91: What Does It Mean & How to Fix It

    Choose the Microsoft Defender Antivirus (offline scan) option and press the Scan now button located underneath.

  13. How to solive a Microsoft Visual Basic Run-time Error 91

    Here is how to solve the issue With over 35 years of experience, the TriMech Group offers a comprehensive range of design, engineering, staffing and manufacturing solutions backed by experience and expertise that is unrivalled in the industry.

  14. How to Fix Word Runtime Error 91 in 4 Ways

    EaseUS Fixo, all-in-one file repair software, offers full-around solutions to repair corrupted photos, videos, and documents of various types.. Repair corrupted Word .doc and .docx files and recover the complete data, maintaining the original form; Fix corrupted Word documents in batches at once

  15. Run-Time Error '91': Object Variable or With Block Variable Not Set

    Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

  16. Runtime Error 91: 7 Effective Methods to Combat the Error

    Follow the steps below to disable these add-ins and bring back your Word: First, close all Word windows. Now, launch the Run utility by pressing Win+R together. 3.Type winword /safe in the box to open the Word application in safe mode. After it opens, navigate to File, Options, and then Add-ins.

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

    Your problem seems to be solved but deep inside you must know that it isn't. You can use the following quick fix: longLastRowNo = .Range("A:A").Find(What:=dateBaltic, LookIn:=xlFormulas).Row. But I would strongly recommend that you use a correct approach, e.g.:

  18. v1.91 does not launch on Catalina or Big Sur due to Fatal error in V8

    Another Big Sur affected here. Clicked restart to update and can no longer launch. Can confirm that downloading v1.9.0 worked. It's a little hard to find the link to download on the page though.

  19. vba

    Function RefreshQuery(shtTFSExcel_Name As String) As Range. Dim activeSheet As Worksheet. Dim teamQueryRange As Range. Dim refreshControl As CommandBarControl. Dim lr As Integer, lc As Integer. Set refreshControl = FindTeamControl("IDC_REFRESH") If refreshControl Is Nothing Then. MsgBox "Could not find Team Foundation commands in Ribbon.