Geeks With Blogs

@urig
  • urig Dear hivemind: Fun stuff to do in London over the weekend? about 506 days ago
  • urig What's the Twitter equivalent of Google+'s Circles? How can I post to only a subset of my followers? about 509 days ago
  • urig "????? ?????? ?? ???? ????????? ????????? ??????? ?? ????? ?????? ??????? ?????? ??? ???? ?? ??????..." http://t.co/4isfVUcBgT about 509 days ago
  • urig @chickos99 @guyzo ?????? ????. ?????? ???? ??? ???? ????? ??? ??? ?????? ????. ?? ???? ??????? ????? ???? ?? ?????. #???????????????????? about 513 days ago
  • urig Supercool. Smart phones as Earth orbiting satellites. - Smartphone Satellites to Launch a Space App Race http://t.co/rzZAglcnur about 551 days ago
  • urig @yehudanuriel LOL, ??????????? ??? ?? ??????. ?????? ????? ??? ?? ?? ????????? ????? ???? ?? ????? ???????? ?? ?????? ??????. about 615 days ago

News

View Uri Goldstein's profile on LinkedIn

Add to Google
urig Tidbits from a .net life

Just had my first encounter with VSTO, trying to embed a C# macro in an Excel workbook. I fired up the ol' Visual Studio 2005, created a new "Excel Workbook" project and bumped straight into this:

"Programmatic access to the Microsoft Office Visual Basic for Applications project system could not be enabled.  If Microsoft Office Word or Microsoft Excel is running, it can prevent programmatic access from being enabled.  Exit Word or Excel before opening or creating your project."

The problem with the above message? I didn't have any Word or Excel process running at all.

A quick google gave me the solution for Office 2003 (thanks go to Harry Miller - MSFT):

  1. On the Tools menu, point to Macro, and then click Security.
  2. Click the Trusted Publishers tab.
  3. Select the check box next to Trust access to Visual Basic Project, and then click OK.
  4. Close all Office applications and try your project again.

But! I'm using Office 2007 beta. Where on earth is the Tools menu there? Yours truly spent well over 2 minutes digging through the menus and ribbons to give you the following instructions:

  1. Open Excel 2007.
  2. Click the Office Button (top-left most button in the window)
  3. Click the Excel Options button.
  4. Click Trust Center in the menu on the left.
  5. Click Trust Center Settings in the window on the right.
  6. In the new window that opens click Macros in the menu on the left.
  7. Check the box next to Trust Access to the VBA project object model.
  8. Click OK.
  9. Click OK.
  10. Close all Office applications and try your project again.

Works like a charm, as long as you accept the security implications of allowing Excel and Word programmatic access to the "Microsoft Office Visual Basic for Applications project system" mentioned above.

Posted on Monday, January 15, 2007 8:50 AM | Back to top


Comments on this post: How to enable programmatic access to VBA in Excel 2007

# Programmatic access to the Microsoft Office Visual Basic for Applications project system could not be enabled.
Requesting Gravatar...
In Darwin i wanted to show off VSTO in Visual Studio 2005. So the night before I fire up Visual Studio
Left by Ozzie Rules Blogging on Feb 21, 2007 4:17 AM

# re: How to enable programmatic access to VBA in Excel 2007
Requesting Gravatar...
Do you have to use/have VSTO to use/run VBAs? We have these worksheets that came with a textbook and it says that a VBA component is not installed. I've done what you did and many other things and it still won't work. Got any ideas? Thanks.
Left by Joey on Jan 22, 2008 10:30 AM

# re: How to enable programmatic access to VBA in Excel 2007
Requesting Gravatar...
Thanks very much - solved my problem
Left by Garry on Mar 25, 2008 6:20 AM

# re: How to enable programmatic access to VBA in Excel 2007
Requesting Gravatar...
nice guide me thx
Left by Hassan Ali on Sep 29, 2009 6:44 AM

# re: How to enable programmatic access to VBA in Excel 2007
Requesting Gravatar...
Just what I was looking for. I assume that it is not possible to do that programaticall?

Does anybody know whether it is possible to set it back again to its previous safe setting?

Thanks
Left by Angus on May 06, 2010 4:12 AM

# re: How to enable programmatic access to VBA in Excel 2007
Requesting Gravatar...
thanks for the info!
Left by Joris on Aug 11, 2010 4:03 AM

# re: How to enable programmatic access to VBA in Excel 2007
Requesting Gravatar...
Hello: Supplementary Note:

Adopted from EXCEL 2007 help:

On the Developer tab, click Visual Basic.
I don't see the Developer tab

Click the Microsoft Office Button , and then click Excel Options.
Click Popular, and then select the Show Developer tab in the Ribbon check box.
Note The Ribbon is part of the Microsoft Office Fluent user interface
Left by ChinaLuoyang on Dec 18, 2010 5:58 AM

# re: How to enable programmatic access to VBA in Excel 2007
Requesting Gravatar...
I installed excel 2007 and opened a new file. But Macros are disabled. I enabled the macros using the Trust Center setting and restarted excel but still it show the macros as disabled. Can anyone help?
Left by Latha on Mar 03, 2011 3:58 AM

# re: How to enable programmatic access to VBA in Excel 2007
Requesting Gravatar...
Thank You for the information I have solved my problem with this piece of information at the time of need.
Left by Md. Murtaza Jamal Hossain on May 25, 2011 7:48 PM

Your comment:
 (will show your gravatar)
 


Copyright © urig | Powered by: GeeksWithBlogs.net | Join free