3

I am trying to connect several macros from Outlook and Excel. One of the functions needs to access vba code from the other program and analyse it. It was quite easy to acces VBA code in Excel from Outlook, for example:

Set WB = Workbooks.Open(Address)
Set codeAddress = WB.VBProject.VBComponents(1).codemodule

But I wonder how to access Outlook macros from Excel. I tried to analyse Outlook application properties through watch window, but I hadn't find anything appropriate. Stackoverflow, have you got any ideas?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Raddle
  • 59
  • 4
  • yes it is possible, you might need to include some reference library to do it. Check out this link http://www.dicks-clicks.com/excel/olBinding.htm – Holmes IV Jun 19 '15 at 14:49
  • As I know, this library should be turned on manually, so the code will be rooted to my computer only =( Is there other ways (like I did in Excel)? – Raddle Jun 19 '15 at 14:52
  • You can turn on automatically a reference to a library. Check here: http://stackoverflow.com/questions/9879825/how-to-add-a-reference-programmatically-in-excel-vba – Philippe K Jun 19 '15 at 14:59
  • What exactly do you need to implement? What is the final goal of such manipulations? – Eugene Astafiev Jun 19 '15 at 14:59

1 Answers1

2

The Outlook object model doesn't provide any property or method for that. The VBAProject.otm file contains all Outlook VBA macros.

All Outlook macros are stored in a single file named VbaProject.otm in the user's %appdata%\Microsoft\Outlook folder, which will be a hidden folder on most systems.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45