Hello,
I would like to have it so when I receive an email via outlook overnight it automatically runs a macro in excel. Is it possible to run the code below directly from excel, otherwise does anyone know how I can run an excel macro from outlook?
cheers
Cage
------------------
Sub Outlook_macro()
Dim ol As Outlook.Application
Set ol = CreateObject("Outlook.Application")
Dim itms As Outlook.Items
Dim itm As Object
Dim email_received As Boolean
Do
Set itms = ol.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items
For Each itm In itms
s = itm.Subject
If s = "Refresh Ready" Then email_received = True
Next
Loop Until email_received
Call excel_macro
End Sub
----------------------------------
I would like to have it so when I receive an email via outlook overnight it automatically runs a macro in excel. Is it possible to run the code below directly from excel, otherwise does anyone know how I can run an excel macro from outlook?
cheers
Cage
------------------
Sub Outlook_macro()
Dim ol As Outlook.Application
Set ol = CreateObject("Outlook.Application")
Dim itms As Outlook.Items
Dim itm As Object
Dim email_received As Boolean
Do
Set itms = ol.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items
For Each itm In itms
s = itm.Subject
If s = "Refresh Ready" Then email_received = True
Next
Loop Until email_received
Call excel_macro
End Sub
----------------------------------