J
JMinahan
I have come to the conlusion simple Outlook 2003 rules won't accomplish what
I need because there is too much logic. What my requirements are that all
email from (e-mail address removed) that have a certain users name it in (Bob Baker for
example), be forwarded to the user name found in the body of the email.
If an email came from test,test.com with "Description: Bob Baker can't log
in" in the body, it would be forwarded to Bob Baker.
Here is the one I want to modify I found:
Public WithEvents myOlItems As Outlook.Items
Public Sub Application_Startup()
' Reference the items in the Inbox. Because myOlItems is declared
' "WithEvents" the ItemAdd event will fire below.
Set myOlItems = Outlook.Session.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub myOlItems_ItemAdd(ByVal Item As Object)
' If it's currently not between 9:00 A.M. and 5:00 P.M.
' If Time() < #9:00:00 AM# Or Time() > #5:00:00 PM# Then
If Item.Subject == "SR" Or Time() > #5:00:00 PM# Then
' Check to make sure it is an Outlook mail message, otherwise
' subsequent code will probably fail depending on what type
' of item it is.
If TypeName(Item) = "MailItem" Then
' Forward the item just received
Set myForward = Item.Forward
' Address the message
myForward.Recipients.Add "(e-mail address removed)"
' Send it
myForward.Send
End If
End If
End Sub
Thanks for any help you can provide.
I need because there is too much logic. What my requirements are that all
email from (e-mail address removed) that have a certain users name it in (Bob Baker for
example), be forwarded to the user name found in the body of the email.
If an email came from test,test.com with "Description: Bob Baker can't log
in" in the body, it would be forwarded to Bob Baker.
Here is the one I want to modify I found:
Public WithEvents myOlItems As Outlook.Items
Public Sub Application_Startup()
' Reference the items in the Inbox. Because myOlItems is declared
' "WithEvents" the ItemAdd event will fire below.
Set myOlItems = Outlook.Session.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub myOlItems_ItemAdd(ByVal Item As Object)
' If it's currently not between 9:00 A.M. and 5:00 P.M.
' If Time() < #9:00:00 AM# Or Time() > #5:00:00 PM# Then
If Item.Subject == "SR" Or Time() > #5:00:00 PM# Then
' Check to make sure it is an Outlook mail message, otherwise
' subsequent code will probably fail depending on what type
' of item it is.
If TypeName(Item) = "MailItem" Then
' Forward the item just received
Set myForward = Item.Forward
' Address the message
myForward.Recipients.Add "(e-mail address removed)"
' Send it
myForward.Send
End If
End If
End Sub
Thanks for any help you can provide.