waris kantroo
waris kantroo

Reputation: 93

How to call a Microsoft office outlook Macro from C#

I have a Macro which fetches some data into the excel file from the Microsoft office outlook (inbox or any other folder). To get the excel file I have to manually run the Macro in the outlook. Is there any way to call the Macro from the C#. I tried to search on Google but couldn’t find anything specific. This is an immediate requirement. Any help with this!!

Upvotes: 2

Views: 1183

Answers (1)

gavlaaaaaaaa
gavlaaaaaaaa

Reputation: 652

Look here This should get you started.

its something along the lines of:

myApp = (Microsoft.Office.Interop.Outlook.ApplicationClass)(Marshal.GetActiveObject("Outlook.Application"));

then have a RunMacro(object theApp, object[] theArgs) method, then you will need to invoke a run on the app and the data inside this method.

Upvotes: 1

Related Questions