Running Excel Macro from Outlook

acp1

New Member
Joined
Apr 19, 2010
Messages
7
I currently have a macro in Outlook that opens up the selected e-mail's attachment (CSV file) in Excel.... (works great!)

Is it possible to run an excel macro (already saved in the global XLA for excel) that then performs some additional work once this CSV has been opened by outlook?

I currently use one of two methods to open Excel files from outlook

Method 1:
Code:
Shell "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE " & FileName
Method 2:
Code:
'open up excel
Dim xlApp As Excel.Application
Set xlApp = New Excel.Application
xlApp.Visible = True
            
'open the attachment
Dim xlWorkbook As Excel.Workbook
Set xlWorkbook = xlApp.Workbooks.Open(FileName:=FileName, UpdateLinks:=False, ReadOnly:=False)
Thoughts? :confused:
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
if its in the global part (accessable from any workbook you open) then you can call it in the code

ie Call mymacro
 
Upvote 0
Tried including the "Call macroName" in my Outlook VBA and no luck...

Are there any other ways of calling an Excel Macro to execute from Outlook VBA? :confused:
 
Upvote 0
Still nothing :(

At least this time it doesn't give an error.... just doesn't do anything :S
 
Upvote 0
have you tried this at the end of method 2?

only other way (kinda cheat) would be under the global this workbook place a call to the macro under workbook open, but this will do it every time you open excel weather you want it to or not
 
Upvote 0

Forum statistics

Threads
1,224,506
Messages
6,179,158
Members
452,892
Latest member
yadavagiri

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top