Error: Code 91 - 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

How to fix the Runtime Code 91 Object variable or With block variable not set

This article features error number Code 91, commonly known as Object variable or With block variable not set described as 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

About Runtime Code 91

Runtime Code 91 happens when Windows fails or crashes whilst it's running, hence its name. It doesn't necessarily mean that the code was corrupt in some way, but just that it did not work during its run-time. This kind of error will appear as an annoying notification on your screen unless handled and corrected. Here are symptoms, causes and ways to troubleshoot the problem.

Definitions (Beta)

Here we list some definitions for the words contained in your error, in an attempt to help you understand your problem. This is a work in progress, so sometimes we might define the word incorrectly, so feel free to skip this section!

  • Assign - Something related to an assignment operation, i.e the process of changing the content of a variable to reflect some given value.
  • Block - This tag is being burninated, because it can refer to many different things depending on the use of other tags with it
  • Declare - Use this tag for questions related to declare, which is usually meant for declaring variables, statements, etc.
  • Object - An object is any entity that can be manipulated by commands in a programming language
  • Reference - A reference is a value that enables a program to indirectly access a particular datum, such as a variable or a record, in the computer's memory or in some other storage device.
  • Set - A set is a collection in which no element is repeated, which may be able to enumerate its elements according to an ordering criterion an "ordered set" or retain no order an "unordered set".

Symptoms of Code 91 - Object variable or With block variable not set

Runtime errors happen without warning. The error message can come up the screen anytime Windows is run. In fact, the error message or some other dialogue box can come up again and again if not addressed early on.

There may be instances of files deletion or new files appearing. Though this symptom is largely due to virus infection, it can be attributed as a symptom for runtime error, as virus infection is one of the causes for runtime error. User may also experience a sudden drop in internet connection speed, yet again, this is not always the case.

Fix Object variable or With block variable not set (Error Code 91)
(For illustrative purposes only)

Causes of Object variable or With block variable not set - Code 91

During software design, programmers code anticipating the occurrence of errors. However, there are no perfect designs, as errors can be expected even with the best program design. Glitches can happen during runtime if a certain error is not experienced and addressed during design and testing.

Runtime errors are generally caused by incompatible programs running at the same time. It may also occur because of memory problem, a bad graphics driver or virus infection. Whatever the case may be, the problem must be resolved immediately to avoid further problems. Here are ways to remedy the error.

Repair Methods

Runtime errors may be annoying and persistent, but it is not totally hopeless, repairs are available. Here are ways to do it.

If a repair method works for you, please click the upvote button to the left of the answer, this will let other users know which repair method is currently working the best.

Please note: Neither nor it's writers claim responsibility for the results of the actions taken from employing any of the repair methods listed on this page - you complete these steps at your own risk.

When you get a runtime error, keep in mind that it is happening due to programs that are conflicting with each other. The first thing you can do to resolve the problem is to stop these conflicting programs.
  • Open Task Manager by clicking Ctrl-Alt-Del at the same time. This will let you see the list of programs currently running.
  • Go to the Processes tab and stop the programs one by one by highlighting each program and clicking the End Process buttom.
  • You will need to observe if the error message will reoccur each time you stop a process.
  • Once you get to identify which program is causing the error, you may go ahead with the next troubleshooting step, reinstalling the application.
Using Control Panel
  • For Windows 7, click the Start Button, then click Control panel, then Uninstall a program
  • For Windows 8, click the Start Button, then scroll down and click More Settings, then click Control panel > Uninstall a program.
  • For Windows 10, just type Control Panel on the search box and click the result, then click Uninstall a program
  • Once inside Programs and Features, click the problem program and click Update or Uninstall.
  • If you chose to update, then you will just need to follow the prompt to complete the process, however if you chose to Uninstall, you will follow the prompt to uninstall and then re-download or use the application's installation disk to reinstall the program.
Using Other Methods
  • For Windows 7, you may find the list of all installed programs when you click Start and scroll your mouse over the list that appear on the tab. You may see on that list utility for uninstalling the program. You may go ahead and uninstall using utilities available in this tab.
  • For Windows 10, you may click Start, then Settings, then choose Apps.
  • Scroll down to see the list of Apps and features installed in your computer.
  • Click the Program which is causing the runtime error, then you may choose to uninstall or click Advanced options to reset the application.
Virus infection causing runtime error on your computer must immediately be prevented, quarantined or deleted. Make sure you update your virus program and run a thorough scan of the computer or, run Windows update so you can get the latest virus definition and fix.
You might be getting the error because of an update, like the MS Visual C++ package which might not be installed properly or completely. What you can do then is to uninstall the current package and install a fresh copy.
  • Uninstall the package by going to Programs and Features, find and highlight the Microsoft Visual C++ Redistributable Package.
  • Click Uninstall on top of the list, and when it is done, reboot your computer.
  • Download the latest redistributable package from Microsoft then install it.
You might also be experiencing runtime error because of a very low free space on your computer.
  • You should consider backing up your files and freeing up space on your hard drive
  • You can also clear your cache and reboot your computer
  • You can also run Disk Cleanup, open your explorer window and right click your main directory (this is usually C: )
  • Click Properties and then click Disk Cleanup
If the error is related to a bad graphics driver, then you may do the following:
  • Open your Device Manager, locate the graphics driver
  • Right click the video card driver then click uninstall, then restart your computer
If the error you are getting is related to the Internet Explorer, you may do the following:
  1. Reset your browser.
    • For Windows 7, you may click Start, go to Control Panel, then click Internet Options on the left side. Then you can click Advanced tab then click the Reset button.
    • For Windows 8 and 10, you may click search and type Internet Options, then go to Advanced tab and click Reset.
  2. Disable script debugging and error notifications.
    • On the same Internet Options window, you may go to Advanced tab and look for Disable script debugging
    • Put a check mark on the radio button
    • At the same time, uncheck the "Display a Notification about every Script Error" item and then click Apply and OK, then reboot your computer.
If these quick fixes do not work, you can always backup files and run repair reinstall on your computer. However, you can do that later when the solutions listed here did not do the job.
Other languages:

Wie beheben Fehler 91 (Objektvariable oder With-Blockvariable nicht gesetzt) - Es gibt zwei Schritte, um eine Objektvariable zu erstellen. Zuerst müssen Sie die Objektvariable deklarieren. Anschließend müssen Sie der Objektvariablen mit der Set-Anweisung eine gültige Referenz zuweisen. Ebenso muss ein With...End With-Block initialisiert werden, indem die
Come fissare Errore 91 (Variabile oggetto o Con variabile di blocco non impostata) - Ci sono due passaggi per creare una variabile oggetto. Per prima cosa devi dichiarare la variabile oggetto. Quindi è necessario assegnare un riferimento valido alla variabile oggetto utilizzando l'istruzione Set. Allo stesso modo, un blocco With...End With deve essere inizializzato eseguendo il comando
Hoe maak je Fout 91 (Object variabele of met blok variabele niet ingesteld) - Er zijn twee stappen om een ​​objectvariabele te maken. Eerst moet u de objectvariabele declareren. Vervolgens moet u een geldige verwijzing naar de objectvariabele toewijzen met behulp van de Set-instructie. Op dezelfde manier moet een With...End With-blok worden geïnitialiseerd door de
Comment réparer Erreur 91 (Variable objet ou Variable avec bloc non définie) - Il y a deux étapes pour créer une variable d'objet. Vous devez d'abord déclarer la variable objet. Ensuite, vous devez affecter une référence valide à la variable objet à l'aide de l'instruction Set. De même, un bloc With...End With doit être initialisé en exécutant la commande
어떻게 고치는 지 오류 91 (개체 변수 또는 With 블록 변수가 설정되지 않았습니다.) - 개체 변수를 만드는 데는 두 단계가 있습니다. 먼저 객체 변수를 선언해야 합니다. 그런 다음 Set 문을 사용하여 개체 변수에 유효한 참조를 할당해야 합니다. 마찬가지로 With...End With 블록은 다음을 실행하여 초기화해야 합니다.
Como corrigir o Erro 91 (Variável de objeto ou com variável de bloco não definida) - Existem duas etapas para criar uma variável de objeto. Primeiro você deve declarar a variável do objeto. Em seguida, você deve atribuir uma referência válida à variável de objeto usando a instrução Set. Da mesma forma, um bloco With ... End With deve ser inicializado executando o
Hur man åtgärdar Fel 91 (Objektvariabel eller Med blockvariabel ej inställd) - Det finns två steg för att skapa en objektvariabel. Först måste du deklarera objektvariabeln. Sedan måste du tilldela en giltig referens till objektvariabeln med Set -satsen. På samma sätt måste ett With ... End With block initieras genom att köra
Как исправить Ошибка 91 (Переменная объекта или переменная блока не задана) - Чтобы создать объектную переменную, нужно выполнить два шага. Сначала вы должны объявить объектную переменную. Затем вы должны назначить действительную ссылку на объектную переменную с помощью оператора Set. Аналогично, блок With ... End With должен быть инициализирован путем выполнения
Jak naprawić Błąd 91 (Zmienna obiektu lub Zmienna blokowa nie jest ustawiona) - Tworzenie zmiennej obiektowej składa się z dwóch kroków. Najpierw musisz zadeklarować zmienną obiektu. Następnie należy przypisać prawidłowe odwołanie do zmiennej obiektu za pomocą instrukcji Set. Podobnie blok With...End With musi zostać zainicjowany przez wykonanie
Cómo arreglar Error 91 (Variable de objeto o con variable de bloque no establecida) - Hay dos pasos para crear una variable de objeto. Primero debes declarar la variable de objeto. Luego debe asignar una referencia válida a la variable de objeto usando la instrucción Set. De manera similar, un bloque With ... End With debe inicializarse ejecutando el

The Author About The Author: Phil Hart has been a Microsoft Community Contributor since 2010. With a current point score over 100,000, they've contributed more than 3000 answers in the Microsoft Support forums and have created almost 200 new help articles in the Technet Wiki.

Follow Us: Facebook Youtube Twitter
Recommended Repair Tool:

This repair tool can fix common computer problems such as blue screens, crashes and freezes, missing DLL files, as well as repair malware/virus damage and more by replacing damaged and missing system files.

Click Here to Download and install the Windows repair tool.

Click on Start Scan and let it analyze your device.

Click on Repair All to fix all of the issues it detected.



1 Ghz CPU, 512 MB RAM, 40 GB HDD
This download offers unlimited scans of your Windows PC for free. Full system repairs start at $19.95.

Article ID: ACX09108EN

Applies To: Windows 10, Windows 8.1, Windows 7, Windows Vista, Windows XP, Windows 2000

Help someone else with this error and Share This Page:
Email Facebook Google LinkedIn Print Twitter

Speed Up Tip #89

Disconnecting Unused USB Devices:

Unused USB devices connected to your PC can significantly slow down boot time. Get rid of them by disconnecting one by one from your computer. By doing that, you will be able to start Windows faster and login to Desktop without much time waiting.

Click Here for another way to speed up your Windows PC
Home     Blog     About     Privacy Policy     Contact Us

Errors in Alphabetical Order:  A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Microsoft & Windows® logos are registered trademarks of Microsoft. Disclaimer: is not affiliated with Microsoft, nor does it claim such affiliation. This page may contain definitions from under the CC-BY-SA license. The information on this page is provided for informational purposes only. © Copyright 2018