If you are using Microsoft Word and are getting Runtime Error 91 whenever a macro, add-in, or document automation process tries to use an object that is not properly set. This article will show you how to solve the proble, though you will probably need to work through quite a few steps. The message usually reads “Object variable or With block variable not set.” It is a VBA related failure rather than a general Windows issue.

Takeaways:

  1. Learn how to fix Runtime Error 91: Object variable or With block variable not set, and the document or macro action cannot continue.
  2. What's causing Runtime Error 91: Object variable or With block variable not set, and the document or macro action cannot continue. on Windows 11?

How to Fix Word Runtime Error 91 on Windows 11

Since this is quite likely to be some kind of extension issue the best bet is to solve the problem via Safe Mode. Since Safe Mode prevents most extensions from loading, it should help identify whether an add-in is causing the issue rather than something else.

  • Press Win + R, type winword /safe, and press Enter.
  • Open Word and check if the error appears again.

If the issue stops:

  • Go to File, then Options, then Add-ins.
  • At the bottom, select COM Add-ins and click Go.
  • Disable all add-ins and restart Word.
  • Re-enable them one by one to find the faulty extension.

Reset the Normal Template

This will reset things to default and should clear out any potential corruption issues. It's quite an easy thing to check as well so give it a go.

  • Close Word completely.
  • Open Run with Win + R and enter %appdata%\Microsoft\Templates.
  • Find Normal.dotm and rename it to Normal.old.
  • Restart Word so it creates a fresh template.

If the error disappears, the original template was damaged.

Check and Disable Problem Macros

Macros are another potential cuase for Runtime Error-91 so disable them. Once you have them all disable slowly enable them again until you find the one that causes the issue.

  • Open the affected document.
  • Press Alt + F11 to open the Visual Basic Editor.
  • Look for macros, event handlers, or form code linked to the issue.
  • Focus on object assignments that may reference missing items.
  • Temporarily disable the macro or remove its trigger.
  • Save a clean version of the file and retest.

If the error is gone, the issue is inside the VBA code itself.

Test the Document Without Automation

Some documents carry embedded automation that only fails under certain conditions. So disable all automation and see what happens.

  • Create a backup of the file.
  • Open the copy in Word.
  • Save it under a new name to reset internal state.
  • If possible, remove macros or save it in a macro free format.
  • Reopen the new file and test the same action.

If the error stops, the original document contained unstable automation.

Repair Microsoft Office

If nothing so far has worked it's time Repair the entire software package.

  • Close all Office apps.
  • Open Settings, then Apps, then Installed Apps.
  • Select Microsoft Office or Microsoft 365.
  • Choose Modify.
  • Run Quick Repair first.
  • If the issue remains, run Online Repair.
  • Restart Word and test again.

Reset Word Registration and User State

If Repairing things didn't work it's time to Reset everything to default settings. Make sure you have backed up all your projects as this will purge everything and set it all clean install setttings.

  • Close Word and all Office processes in Task Manager.
  • Press Win + R, type winword /r, and press Enter.
  • This refreshes Word registration and file associations.
  • Open Word and test the same workflow again.

Note: If needed, remove recent customizations in your user profile and retest with a clean session.