vba move email to folder if subject is like? -
I am using the following code to move emails from my inbox to a folder called Supplier in another folder. It currently works if the subject is' Introduction ', but not, if the subject is' My Introduction', I
what I want to do is add a line which says that the topic or body like 'introduction 'Or' like 'or' supply 'etc. ...
In addition, I have many accounts in my view, at the moment, this code only works for my default account, but I want to do this for my account 'Purchasing@Hewden.co.uk', why Is there a way that I can change? My 'Supplier' folder is within the inbox of my purchasing@hewden.co.uk account and I want to take the email from the supplier folder this inbox.
sub MoveItems () Dim MyNamespace MyNamespace = Application.GetNamespace ( "MAPI") myInbox = myNameSpace.GetDefaultFolder set (olFolderInbox) Outlook.NameSpace dim myInbox Outlook.Folder dim myDestFolder Outlook.Folder dim myItems Outlook.Items set as the set of the object as in as dim myItem myItems = myInbox .Items set myDestFolder = myInbox.Folders ( "Supplier") set myItem = myItems.Find ( "[concerning] = 'Introduction' ") while TypeName (myItem) & lt; & Gt; "Nothing" myItem.Move myDestFolder set myItem = myItems.FindNext Wend End Sub
I know that question asked for the code, but it can be very easy through the use of rules, if it does not want to answer, I will remove it.
Yet to learn about the rules and the rules, they are really very good. You can filter on the basis of a keyword within want to make a new rule and subject line, you can write "Introduction" and Outlook will know to look at the words.
Do you also need to specify that is where e-mail and, in my case, you also need to specify that new mail when it comes to what type of displays notifications (if any) .
It should be available under its rules - & gt; Create a new rule.
Comments
Post a Comment