• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Help creating macro for conditional formatting settings

Andrew85

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
#1
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)
 

Andrew85

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
#3
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
#4
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.
 
Outlook version
Outlook 2010 32 bit
Email Account
POP3
#5
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.
 

Andrew85

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
#6
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!
 
Outlook version
Outlook 2010 32 bit
Email Account
POP3
#8
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.

¡Éxitos!

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
'******SENDER
Select Case Trim(UCase(objItem.SenderName))
Case "DIAZ CARMEN"
objItem.Categories = "DIAZ CARMEN"
objItem.Save
Case "CEVALLOS DAYSE"
objItem.Categories = "CEVALLOS DAYSE"
objItem.Save
Case "ANDREW85"
objItem.Categories = "ANDREW85"
objItem.Save
End Select

'*****SUBJECT
If InStr(1, Trim(UCase(objItem.Subject)), Trim(UCase("PURCHASE")), vbTextCompare) <> 0 Then
objItem.Categories = "PURCHASE"
objItem.Save
End If
End If
Next
End Sub
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
#9
By assigning "Purchase" you erase any other category that could be assigned. Is that intended? If not, use this one:
Code:
objItem.Categories=objItem.Categories & ";Purchase"
BTW: This is an English speaking forum. You English is very good, please use it.