Visual Studio/Office 2010 development and programmatic access to the VBA Project System

While attempting to spin up some VS/Office 2010 Excel development today I kept running into this following error message:

“Programmatic access to the Microsoft Office Visual Basic for Applications project system could not be enabled.”

I was trying to create Office Development projects by opening existing workbooks (about to embark on some very exciting and long-overdue updates to an 8 year old Office VBA project) and in some cases the project was created but the error kept recurring every time I opened the project in VS2010.  In other cases the project creation wizard aborted without creating the project.

This is one of those errors that I dread trying to uncover help for on the web – it seems so specific to my exact situation that I’m unlikely to find help, but in this case I was pleasantly surprised – googling the exact error message retuned a couple of valid-looking hits:

The second points to the first as its source, so really only one actual result, but it looked valid.  Awesome! My problem is about to be solved!

Only not so much.  Turns out that the setting under discussion( “Trust access to the VBA project object model” in Office 2010) was already set to the correct value in Office 2010. Apparently no help here.

So I fiddled around a little more, tried restarting to see if perhaps some ghost of an office app still had a hold on the VBA project model (the error specifically says that if you have Word or Excel open that can block programmatic access).  No joy.

So I finally went back to the posts in question and re-read them. They seem perfectly relevant and specific to my exact error.  The only difference being that they’re focused on Office 2007 and not Office 2010….

Ding.

I have both Office 2007 and Office 2010 installed. The relevant configuration point was set in 2010, but not in 2007.  I set it in 2007 and everything is hunky-dory.

Posting as a public service, to enhance the memory of the web, in case someone else has this problem (or in case I have it again and forget what I did to resolve it).

(sent to http://cori.posterous.com via email)

  • byghtguy

    youre my new hero. i was struggling trying to create a simple excel 2007 app in c# and couldn’t get past the error message. all the web sights said to check the “trusted …” checkbox in excel 2007 — and mine WAS checked, so what the hell.
    after a long time searching i found your note. your “ding” says it perfectly. like you, i also have excel 2010 installed, and when i checked there the box was not checked. so i checked that box, tried again, and it worked like a charm.
    thanks much for the help!