0
votes

I'd like to write a macro for Outlook 2007 that can add/remove modules in the VBA editor. The VBA Extensibility library looks perfect, but properties like Application.VBE seem to be inaccessible.

In Excel, I would need to enable "Trust access to the VBA project object model". Unfortunately, this option is missing in Outlook 2007.

Does anyone know of a way around this?

Thanks in advance!

1
I don't believe its possible as you already know that there is no option to trust programmatic access to the VBA IDE or VB Project. Even if it was possible then that would have been a large security hole...Siddharth Rout
I agree with Siddhard Rout. The behavior you are looking for could easily be exploited by a computer trojan or worm to spread malicious code via email. It would make perfect sense that Microsoft has disabled such access to the VBE library for security.EastOfJupiter
Since macros have full access to the file system, that seems like a rather ineffective security measure. Many other options exist, such as indirectly replacing its own VbaProject.OTM...Tim McLean

1 Answers

0
votes

I worked around the limitations using SendKeys:

  • Alt-F11
  • Ctrl-M
  • Path to code module
  • Enter

Not elegant, but good enough.