Help creating macro for conditional formatting settings

Not open for further replies.


New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Hello all,

I am looking to see if it is possible to create a macro in Outlook for conditional formatting. Such as if an email has a specific keyword, or is from this person, it will be displayed in a different color etc. I realize you can do this by going to View > View Settings > Conditional Formatting, however I work in a office of 75+ people and this would be quite tedious to do this for every single person, is there an easy VBA code one can use? Help! I've googled around and have not really seen any for this question, mostly articles that direct people to use the conditional formatting setting included within Outlook. Any suggestions or thoughts? Thanks!

(Note: we use Office 2013 and 2010 32 bit)
Well, if you just need color, I'd look at categories - they are easier to use. I'm not aware of any other way to push out views.
Hola Andrew85, ¿para qué deseas identificar los correos de las 75 personas?
Es cierto, que puedes utilizar las categorías, y crear un macro, que cuando te llegue un correo de un determinado remitente o una palabra específica en el asunto, automáticamente asigne una categoría.
Esto también lo puedes hacer con una regla.

Hi Andrew85, why would you want to identify the 75 people post?
True, you can use the categories, and create a macro that when you reach a mail from a particular sender or a specific word in the subject will automatically assign a category.
This is also you can do with a ruler.
Thanks everyone for the replies. I think categories is probably the best option then as Jorge and Diane stated. Could someone post a sample macro of what that would look like? For example if specific sender/word in email comes in, it will assign it to a category? Thanks!
Amigo, prueba con este código.
Se ejecuta cuando el correo llega, ahora hay un pequeño inconveniente, por la experiencia, si recibes mucho correos al mismo tiempo, le va a tomar tiempo al Outlook procesar el código.
También dependiendo del proceso que hagas se puede optimizar tu trabajo. Haber si te puedo ayudar.


Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim varEntryIDs
Dim objItem
Dim i As Integer
varEntryIDs = Split(EntryIDCollection, ",")
For i = 0 To UBound(varEntryIDs)
Set objItem = Application.Session.GetItemFromID(varEntryIDs(i))
If objItem.Class = 43 Then
Select Case Trim(UCase(objItem.SenderName))
objItem.Categories = "DIAZ CARMEN"
objItem.Categories = "CEVALLOS DAYSE"
Case "ANDREW85"
objItem.Categories = "ANDREW85"
End Select

If InStr(1, Trim(UCase(objItem.Subject)), Trim(UCase("PURCHASE")), vbTextCompare) <> 0 Then
objItem.Categories = "PURCHASE"
End If
End If
End Sub
By assigning "Purchase" you erase any other category that could be assigned. Is that intended? If not, use this one:
objItem.Categories=objItem.Categories & ";Purchase"

BTW: This is an English speaking forum. You English is very good, please use it.
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
N Help creating a VBA macro with conditional formatting to change the font color of all external emails to red Outlook VBA and Custom Forms 5
S Custom Contact card - need help creating one Outlook VBA and Custom Forms 1
B Need Help Creating Email Based on Subject w Address in Body Outlook VBA and Custom Forms 1
F Creating Meeting Request Custom form and distribute it to domain user HELP!!! Using Outlook 0
F Creating Meeting Request Custom form and distribute it to domain user HELP!!! Using Outlook 0
A Help creating custom Contacts form - what type is 'Email' control? Outlook VBA and Custom Forms 1
A Need help in creating a mass emailing plugin Outlook VBA and Custom Forms 1
D Lifelong Windows user - new to Mac - Help!!! Using Outlook 3
L Help: set flag for sent mail to check if received an answer Outlook VBA and Custom Forms 2
Nufc1980 Outlook "Please treat this as private label" auto added to some emails - Help. Using Outlook 4
I Help with Smart Folder + Query Builder on IMAP Using Outlook 0
S Outlook 2002- "Send" button has disappeared. Help please. Using Outlook 1
A Outlook 2019 Help with forwarding email without mentioning the previous email sender. Outlook VBA and Custom Forms 0
Witzker Outlook 2019 HELP to get Template Path in a Function Outlook VBA and Custom Forms 2
CWM330 Outlook 365 HELP! Calendar Craziness! Using Outlook 5
S Outlook 365 Help me create a Macro to make some received emails into tasks? Outlook VBA and Custom Forms 1
e_a_g_l_e_p_i Has nobody used Office 2021 enough to help me or have you given up on Using Outlook 1
X Open Hyperlinks in an Outlook Email Message (Help with Diane's solution) Outlook VBA and Custom Forms 3
L Help connecting to hosted exchange server 2016 Using Outlook 0
B Seeking help with Outlook rule Using Outlook 2
D Need help with MS Authenticator Using Outlook 4
I Outlook for Mac 2019 using on desktop and laptop IMAP on both need help with folders Using Outlook 1
FryW Need help modifying a VBA script for in coming emails to auto set custom reminder time Outlook VBA and Custom Forms 0
S.Champ Please help? I've imported a random workcalendar I dont even know who's. Can I undo it? and then I need to re-sync the google one again. Its a mess:( Using Outlook 2
S HTML to Plain Text Macro - Help Outlook VBA and Custom Forms 1
e_a_g_l_e_p_i Outlook 2010 Help setting up Gmail account in Outlook 2010 Using Outlook 3
Y Filter unread emails in a search folder vba help Outlook VBA and Custom Forms 0
L Need help modifying a VBA script for emails stuck in Outbox Outlook VBA and Custom Forms 6
F Microsoft Outlook Connector 14.0.6123.5001 - Help! Using Outlook 6
Witzker Pls help to change the code for inserting date in Ol contact body Outlook VBA and Custom Forms 5
R Disable conversation thread from replying of recipients in the same subject. Please help Using Outlook 0
R seperate read layout to design in outlook 2016..Help!! Outlook VBA and Custom Forms 3
O Help .. got lost ... installing Office like 2016 Using Outlook 5
A Arthur needs help with 2007 Outlook e-mail Using accounts in Outlook 3
R Help Revising VBA macro to delete email over different time span Outlook VBA and Custom Forms 0
Marc2019 Need help please! Cannot Setup my outlook email account on my Mac Outlook 2011 Using accounts in Outlook 2
L Attachment saving and tracking - PLEASE help! Outlook VBA and Custom Forms 5
I Help with dates in task list. Using Outlook 5
C need help setting up outlook first time Using Outlook 1
K To do bar help Using Outlook 8
M Help sending email but removing signature via VBA Outlook VBA and Custom Forms 5
S help with outlook scripting Outlook VBA and Custom Forms 4
J Help Please!!! Outlook 2016 - VBA Macro for replying with attachment in meeting invite Outlook VBA and Custom Forms 9
EmelineGueguen Help to understand the problem of work Using Outlook 1
N Outlook Forms Help Outlook VBA and Custom Forms 2
N Need help syncing contacts to iPhone X Using Outlook 8
S VBA Macro - Run-time error '424': object required - Help Please Outlook VBA and Custom Forms 3
broadbander Needing help with reply/reply all while keeping attachments and adding a new CC recipient. Outlook VBA and Custom Forms 5
J Help! My contacts have disappeared. Using Outlook 5
J HELP- Rule to auto strip prepend from external emails Using Outlook 0

Similar threads