Call Excel 2002 Macro from Outlook 2002

R

Reto Walker

Hello everyone

I have posted this to the regular Outlook forum but there seems to be no
easy solution to the following question:

How can I run an Excel 2002 macro (which already exists and sends out an
Excel selection via e-mail) whenever I receive an e-mail in Outlook with a
certain subject?

E.g. when Outlook (2002) receives an e-mail with subject: "Run Excel Macro"
it should activate Excel and run the macro.

I tried to accomplish this task by using "Outlook's Rules Wizard - Run
Script" selection but have failed to get a simple macro such as:

Sub SendMailOutlook()
Application.Run "'Tradestation.xls'!MailValue"
End Sub

working proberly.

Any help is highly appreciated.

Regards,

Reto
 
S

Sue Mosher [MVP-Outlook]

If your code below is Outlook VBA, the Application object referred to is
Outlook's intrinsic Application object. If you want to run an Excel macro,
you need an Excel Application object:

Set objExcel = CreateObject("Excel.Application")
Set objWB = objExcel.Workbooks.Open("C:\mymacro.xls")
objExcel.Run ("MyMacro.xls!MyMacro")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top