Database updates are currently taking place!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
 
Business Applications
Tag Cloud
acer audio boot bsod computer connection crash dell display driver drivers error firefox freeze google hard disk hard drive hardware hijackthis install internet itunes keyboard laptop linksys macro malware network outlook outlook 2003 outlook 2007 problem ram realtek recovery redirect server slow trojan upgrade usb video virus vista windows windows 7 windows vista windows xp wireless youtube
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Business Applications >
Solved: Run excel macro when new email is received

Tip: Click here to scan for System Errors and Optimize PC performance
[ Sponsored Link ]

Closed Thread
 
Thread Tools
alvesm1's Avatar
Junior Member with 5 posts.
 
Join Date: Jul 2009
16-Jul-2009, 06:56 AM #1
Solved: Run excel macro when new email is received
Hello

I need to come up with a simple outlook macro (or script?) that fires off whenever a new email meeting certain criteria is received.

1. new email is received with "please refresh quotes" in the subject
2. outlook runs a macro that causes another macro to run (the second macro is located in a excel workbook which is already running in my office pc)
3. the excel (attached) is simply refreshing market prices and emails whenever the macro is triggered. because the quotes are obtained via a DLL feed I can only get it at work.

the purpose is simply to get live market quotes on my personal email from my work email whenever i need.


thanks in advance for your help.
Attached Files
File Type: xls fire_mk_quotes.xls (30.0 KB, 163 views)
vane0326's Avatar
Senior Member with 106 posts.
 
Join Date: May 2006
16-Jul-2009, 05:13 PM #2
First copy this code below and go to TOOLS >> MACRO >> VISUAL BASIC EDITOR then right click on "Microsoft Office Outlook" click on INSERT >> MODULE and paste the code in white area. Then go to the top of the menu bar click TOOLS >> References >> and look for Microsoft Excel 11.0 Object Library or Microsoft Excel 12.0 Object Library and check mark it and save it. close out Oulook and reopen it.

Now go to TOOLs >>RULES and ALERT >> NEW RULE >> click on CHECK MESSAGE WHEN THEY ARRIVE >> CHECK MARK "Specific words in the Subject line" then at the bottom click "Specific words" and type "Please refresh Quotes" (Without the quotes) click add then click next and check mark "run script" then at the bottom box click "a script" and select ok and click finish.



Code:
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 "Button1_Click"
End Sub
alvesm1's Avatar
Junior Member with 5 posts.
 
Join Date: Jul 2009
17-Jul-2009, 02:36 AM #3
Thanks vane0326

I did everything you said but when I am creating th rule and click the "a script" hyperlink it doesnīt list any scripts

can you help?


Thanks again
vane0326's Avatar
Senior Member with 106 posts.
 
Join Date: May 2006
17-Jul-2009, 08:12 AM #4
I left an attachment that shows if you have created a module in your outlook vba editor. Also, you might have to turn off your macro security. Go to TOOLS >> MACRO >> SECURITY >> and turn off your macro security.
Attached Thumbnails
Solved: Run excel macro when new email is received-macro.jpg  
alvesm1's Avatar
Junior Member with 5 posts.
 
Join Date: Jul 2009
17-Jul-2009, 12:00 PM #5
Thanks for you reply vane but still nothing.

I have my vb editor exactly as it should look like and i have the macro security setting as low, and itīs still not listing any scripts whenever I create a rule.

Thanks again.
Attached Thumbnails
Solved: Run excel macro when new email is received-ms-outlook-macro.jpg  
vane0326's Avatar
Senior Member with 106 posts.
 
Join Date: May 2006
17-Jul-2009, 03:48 PM #6
Use this instead. Copy this code below and paste it into the new module.


Code:
Sub ExcelMacro(MyMail As MailItem)

Dim objMail As Outlook.MailItem
Dim eApp As Excel.Application

'Place path to sav to on next line. Note that you must include the
'final backslash
    Set eApp = GetObject(, "Excel.Application") 'Assumes Excel is open,
        'Use CreateObject if Excel is not open.
    eApp.Run "Button1_Click"

End Sub
alvesm1's Avatar
Junior Member with 5 posts.
 
Join Date: Jul 2009
19-Jul-2009, 03:19 AM #7
Thanks vane, I am away from office until monday the 27th, I will try it then and let you know.
alvesm1's Avatar
Junior Member with 5 posts.
 
Join Date: Jul 2009
29-Jul-2009, 02:42 AM #8
Perfect it works, thanks indeed Vane.
Closed Thread

Tags
automated, excel, macro, outlook

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.

Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -5. The time now is 10:00 PM.
Copyright © 1996 - 2010 TechGuy, Inc. All rights reserved.
Powered by Cermak Technologies, Inc.