Call Excel Macro from Outlook

S

sjstewart1981

Hi
How do you call an excel macro from Outlook? I have an excel macro
that relies on an email I get everyday, so I have a macro in Outlook
that copies the excel attachment to a certain folder. I would then
like that macro to open up a workbook in Excel that has my macro in
and autorun it without me having to open it manually. Is this
possible?

Thanks,
Simon
 
G

Guest

Simon, try something like this:
Sub CallExcelMacro()
Dim eApp As Excel.Application
'Note: Must have set reference to:
'Microsoft Excel 11.0 Object Library
'This is accessed in the VBE Editor
'Under Tools -> References...
Set eApp = GetObject(,"Excel.Application") 'Assumes Excel is open,
'Use CreateObject if Excel is not open.
eApp.Run "HelloWorld" 'Runs the subroutine name "HelloWorld"
End Sub

Let me know if you have problems.
 
S

sjstewart1981

Brilliant thanks Charles, I will try it out and let you know how i get
on! Simon
 

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