Running existing macro from Com add-in in Outlook 2007

Add-in Express™ Support Service
That's what is more important than anything else

Running existing macro from Com add-in in Outlook 2007
 
ademan




Posts: 47
Joined: 2007-05-03
Hello,

In our add-in we want to have the possibility to run an existing (3rd party) macro in Outlook 2007. Does anybody know if that possible? The Outlook object does not have a Run method like Word or Excel. I tried by using InvokeMember (this was at mentioned http://blogs.msdn.com/sachinsancheti/archive/2006/05/16/598951.aspx) but so far no luck there.

Invoke member from Com add-in:
OutlookApp.GetType().InvokeMember("TestMacro", BindingFlags.InvokeMethod, null, OutlookApp, new object[] { });

My simple test macro:
Public Sub TestMacro()
MsgBox "It works"
End Sub
Posted 26 Mar, 2010 05:07:20 Top
Andrei Smolin


Add-in Express team


Posts: 19138
Joined: 2006-05-11
Hi Alexander,

I don't think it is possible to run an Outlook macro in this way. I'd suggest adding a button (Office.CommandBarButton) to a toolbar or menu, assigning CommandBarButton.OnAction="{macro name}" and calling CommandBarButton.Execute.


Andrei Smolin
Add-in Express Team Leader
Posted 26 Mar, 2010 08:31:48 Top
Alexander de Man




Posts: 47
Joined: 2007-05-03
Hi Andrei,

Thats solves it. Thanks again for you help :)
Posted 26 Mar, 2010 09:33:42 Top