1
Hello I want to create a rule or a vba in outlook, where the subject line has 3 certain words in any order. For instance, I want to look for "Badges, user, moped"
Subject says: the badges and the user with a moped.
If the subject has those three words in it, then I want it to forward the email to someone.
found this code created by "mark-goldfain", I was thinking maybe we can modify it? Although I do not know anything about VBA programming.
Public Sub File_Stock_Incoming_Message(Item As Outlook.MailItem)
' This macro is called from a wizard-built rule, where the
' rule operates on *every* incoming message, and its action
' is to call this macro.
Dim NS As Outlook.NameSpace
Set NS = Application.Session
Dim MoveToFolder As Outlook.MAPIFolder
Set MoveToFolder = NS.Folders("mainboxname").Folders("MsgLog")
Dim sbjstr As String
sbjstr = Item.Subject
If (sbjstr = "Whatever Site Error") Then
Item.Move MoveToFolder
End If
End Sub
Why not just use a rule? – Raystafarian – 2015-12-10T12:00:54.413
Let me give this a try and will let you know if it works. Also, how would you tell the VBA to forward the email to : joe@joe.com? – Juan Flores – 2015-12-10T21:20:42.140
Raystafarian, The reason that I don't want to use a rule, is that I am looking for just 3 specific words in the subject. So, it would be if , word 1 and word 2 and word 3 exist in the subject. Forward the email to someone@someon.com. – Juan Flores – 2015-12-10T22:54:34.433