VBA unavailable from Office programs

aviramicrosoft-officemicrosoft-office-2010vba

I recently reinstalled Windows 10, Avira Free Antivirus v. 15.0.44.142, and Office Professional Plus 2010. Before the reinstallation, this combination of applications worked fine.

Now, when I try to open the VBA IDE from a new Word document, I get the following message:

Word has encountered a problem.

There is a problem saving the file.

with some possible causes listed underneath, such as missing disk space, low RAM, or missing permissions; none of which are relevant.

The only thing that might be relevant is:

This error can also occur if the computer is running a version of antivirus software that is incompatible with the Microsoft Office or must be updated.

As noted, I am running Avira Free Antivirus, and AFAICT the antivirus is updated. I tried opening the VBA IDE while Avira real-time protection was turned off, but without success.

Once I dismiss the message, the VBA IDE window opens, but there is no available project, and most of the menu items are disabled.

Saving a document with the .docm extension before opening the VBA IDE doesn't help.

There are comparable odd results when trying to open the VBA IDE from other applications:

  • Excel lists three projects Project1, Project2 and Project3, but without the usual tree of objects underneath each project — class modules, standard modules etc — and without the ThisWorkbook node.
  • PowerPoint does the same as Word — no project at all — but without any error.

I've tried uninstalling and reinstalling VBA via the Office installer.

Security settings are set to disable macros with a warning. IIRC the old behavior was to disable macros unless I explicitly allowed them for the specific document. Trust the object model for each application is checked.

I've looked for a setting to control this in Avira, with no success.

The registry doesn't contain the VBAOff key described here.

How can I enable VBA for the Office applications?

NB. The previous installation wasn't a clean install of Windows 10; it was first Windows 8, then 8.1, then 10.

Things I have tried before opening the VBA editor:

  • Repair Office
  • Uninstall and reinstall Office, then manually install Office 2010 SP2
  • Windows update (only found Office updates after the aforemnetioned manual installation)
  • Running Word with administrator permissions
  • Enable all macros selected from the Trust Center
  • Deleting the Normal.dotm template and allowing Word to recreate it
  • Uninstalling Office, running the "Clean Office uninstall" tool referenced by @harrymc in the comments, and reinstalling Office
  • Adding Outlook (which was previously not installed)
  • Turning off UAC (before starting Word)
  • Booting in Safe Mode — I was unable to start Word; Word wasn't recognized as activated
  • Setting HKLM\SYSTEM\CurrentControlSet\Control\FileSystem LongPathsEnabled = 1, and rebooting

Looking at the Event Viewer, I didn't find anything in System, Application or Security (all under Windows Logs). The only thing I did find was the following event in Applications and Services Logs -> Microsoft Office Alerts every time I try to open the VBA editor in Word on a new document:

Log Name:      OAlerts
Source:        Microsoft Office 14 Alerts
Date:          07/03/2019 20:49:42
Event ID:      300
Task Category: None
Level:         Information
Keywords:      Classic
User:          N/A
Description:
Microsoft Word
Word has encountered a problem.
P1: 200815
P2: 14.0.7015.1000
P3: 5v59
P4: 0x80070002

Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Microsoft Office 14 Alerts" />
    <EventID Qualifiers="0">300</EventID>
    <Level>4</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2019-03-07T18:49:42.772417400Z" />
    <EventRecordID>120</EventRecordID>
    <Channel>OAlerts</Channel>
    <Security />
  </System>
  <EventData>
    <Data>Microsoft Word</Data>
    <Data>Word has encountered a problem.</Data>
    <Data>200815</Data>
    <Data>14.0.7015.1000</Data>
    <Data>5v59</Data>
    <Data>0x80070002</Data>
  </EventData>
</Event>

There is no similar event when opening the editor in Excel or PowerPoint.


Using Sysinternals ProcMon, capturing only while trying to open the VBA editor from Word, and filtering the results for Process Name = "WINWORD.EXE" and excluding SUCCESS, BUFFER OVERFLOW and NAME NOT FOUND from Result, I found the following:

RegOpenKey         ACCESS DENIED      
      HKLM\Software\WOW6432Node\Microsoft\VBA
CreateFileMapping  FILE LOCKED WITH READERS
      C:\Program Files (x86)\Common Files\microsoft shared\VBA\VBA7\VBE7.DLL
CreateFileMapping  FILE LOCKED WITH READERS
      C:\Program Files (x86)\Common Files\microsoft shared\VBA\VBA6\VBE6EXT.OLB

The FILE LOCKED WITH READERS repeats a number of times.

But on further investigation, I see that later reads from the same registry key (HKLM\Software\WOW6432Node\Microsoft\VBA) succeed. Also, the CreateFileMapping is using the long name of the path; which is immediately followed by a successful CreateFileMapping using the DOS name, e.g. C:\PROGRA~2\COMMON~1\MICROS~1\VBA\VBA7\VBE7.DLL.

Best Answer

Verify or install the latest updates

You might have to set Windows Update to automatically download and install recommended updates. Installing any important, recommended, and optional updates can frequently correct problems by replacing out-of-date files and fixing vulnerabilities. To install the latest Microsoft Office updates, see Update Office and your computer with Microsoft Update.

For list of the latest Office updates, see Office Updates. If your issue is not resolved after you install the latest Windows and Office updates, go to method 2.

It's a good idea to make sure that your computer has the latest updates installed for Windows. Updates often fix software problems. Before you use any of the following methods, try first to install updates. After you install the updates, restart your computer, and then start Word.

Troubleshoot problems that occur when you start Word

Important
Follow the steps in this section carefully. Serious problems might occur if you modify the registry incorrectly. Before you modify it, back up the registry for restoration in case problems occur.

Here are troubleshooting methods you should try:

Method 1: Insert your document into another file
Method 2: Start Word by using the /a switch
Method 3: Delete the Word Data registry subkey
Method 4: Delete the Word Options registry key
Method 5: Replace the Normal.dot or Normal.dotm global template file
Method 6: Disable the Startup folder add-ins
Method 7: Delete the COM add-ins registry keys
Method 8: Change the default printer

Follow details in MSDN.

Related Question