Thursday, September 3, 2015

VBA unavailable from Office programs

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:



300
4
0
0x80000000000000

120
OAlerts



Microsoft Word
Word has encountered a problem.
200815
14.0.7015.1000
5v59
0x80070002



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.

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...