![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hello all,
Im needing to create some custom rules to orginize my email for me. I need to write a rule so that an email containning an specific word in the subject, sent to a person in a specific address book, or from a person in a specific address book moved to a specific folder. I know i have to use vba because the wiz wont allow for an or it will only use and. Can any one please help me with this? |
Ads |
#2
|
|||
|
|||
![]()
What version of Outlook? If this is Outlook 2007 you can use the new Rules
collection, if not then you must have a rule that calls into a VBA macro formatted in a specific way. See http://www.outlookcode.com/article.aspx?id=62 and look for the run a script rule. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "mherber2" wrote in message ... Hello all, Im needing to create some custom rules to orginize my email for me. I need to write a rule so that an email containning an specific word in the subject, sent to a person in a specific address book, or from a person in a specific address book moved to a specific folder. I know i have to use vba because the wiz wont allow for an or it will only use and. Can any one please help me with this? -- mherber2 |
#3
|
|||
|
|||
![]()
i am using 2007 however there is not a built in rule to sort when a message is sent to someone in a specified address book
Quote:
|
#4
|
|||
|
|||
![]()
It looks like there aren't any conditions that meet what you want in the
Rules collection, so a rule that runs a script is your best bet. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "mherber2" wrote in message ... i am using 2007 however there is not a built in rule to sort when a message is sent to someone in a specified address book |
#5
|
|||
|
|||
![]()
thats not a problem can you assist me in writing the script?
Quote:
|
#6
|
|||
|
|||
![]()
Start coding it and post any problems or questions and someone will help.
-- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "mherber2" wrote in message ... thats not a problem can you assist me in writing the script? |
#7
|
|||
|
|||
![]()
i have experiance in vba for excell and power point but i have no clue where to begin here. i've been working on coding it but cannt get anywhere
Quote:
|
#8
|
|||
|
|||
![]()
Well, the rule calling the macro "script" is passed a Mailitem object for
the item. To check for Subject containing a specific word: Sub myRuleCode(Item As Outlook.MailItem) If InStr(1, Item.Subject, "foobar", vbTextCompare) 0 Then ' it has the subject word "foobar" there To check for the recipient being in a specific AddressBook you'd need to get the Item.Recipients collection and iterate, checking each Recipient for their email address and seeing if the Recipient.Type = olTo (if you only want to check the To recipient or recipients). The AddressBook would be retrieved from the AddressLists collection as an AddressList object. You'd get its AddressEntries collection and iterate that looking for an AddressEntry where the Address property was equal to the Recipient.Address. To check for the sender being in the AddressEntries collection you'd use the Item.SenderEmailAddress property and compare that to each AddressEntry.Address value in that AddressBook. If you know the name of the AddressBook you want to work with you'd get it like this: Dim oList As Outlook.AddressList Set oList = Application.GetNameSpace("MAPI").AddressLists.Item ("myAddressList") That should get you going. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "mherber2" wrote in message ... i have experiance in vba for excell and power point but i have no clue where to begin here. i've been working on coding it but cannt get anywhere |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to get outlook rule | Ashish | Add-ins for Outlook | 1 | February 21st 09 09:47 PM |
Outlook rule | Stefan | Outlook - General Queries | 1 | December 4th 08 01:16 PM |
outlook rule | [email protected] | Outlook - General Queries | 2 | May 2nd 07 01:52 PM |
Outlook Rule | JoeCL | Outlook - Installation | 1 | November 21st 06 08:50 PM |
How to setup a rule to forward rule in Outlook (xp or 2003) to forward emails from a certain domain when app isnt running? | KingCronos | Outlook - General Queries | 7 | November 15th 06 11:22 AM |