Hello, friends. I'm trying to adapt this code for using in a different Mail Inbox named "Workgroup", but I don't get it. I don't know if a need replace entire main "My Inbox" or create a route from there. In any case, I don't get it!
In adiccion, I'm trying to categorize my eMails with a blue color, but at the momento I only got it put a name "Susi".
someone for helping me? thanks in advance!
Public Sub NewInbox_Su ()
Dim myNameSpace As Outlook.NameSpace
Dim myInbox As Outlook.Folder 'Here is my doubt, I don't know how to refer other Inbox
Dim myItem As MailItem
Dim lngCount As Long
Set myNameSpace = Application.GetNamespace("MAPI")
Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
MsgBox myInbox.UnReadItemCount
If myInbox.UnReadItemCount > 0 Then
For lngCount = myInbox.Items.Count To 1 Step -1
If TypeName(myInbox.Items(lngCount)) = "MailItem" Then
If myInbox.Items(lngCount).UnRead = True Then
Set myItem = myInbox.Items(lngCount)
If InStr(LCase(myItem.Body), "alarm") > 0 Or _
InStr(LCase(myItem.Subject), "urgent") > 0 Then
myItem.Categories = "Susi"
myItem.Save
End If
End If
End If
DoEvents
Next lngCount
End If
Set myNameSpace = Nothing
Set myInbox = Nothing
Set myItem = Nothing
End Sub
In adiccion, I'm trying to categorize my eMails with a blue color, but at the momento I only got it put a name "Susi".
someone for helping me? thanks in advance!
Public Sub NewInbox_Su ()
Dim myNameSpace As Outlook.NameSpace
Dim myInbox As Outlook.Folder 'Here is my doubt, I don't know how to refer other Inbox
Dim myItem As MailItem
Dim lngCount As Long
Set myNameSpace = Application.GetNamespace("MAPI")
Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
MsgBox myInbox.UnReadItemCount
If myInbox.UnReadItemCount > 0 Then
For lngCount = myInbox.Items.Count To 1 Step -1
If TypeName(myInbox.Items(lngCount)) = "MailItem" Then
If myInbox.Items(lngCount).UnRead = True Then
Set myItem = myInbox.Items(lngCount)
If InStr(LCase(myItem.Body), "alarm") > 0 Or _
InStr(LCase(myItem.Subject), "urgent") > 0 Then
myItem.Categories = "Susi"
myItem.Save
End If
End If
End If
DoEvents
Next lngCount
End If
Set myNameSpace = Nothing
Set myInbox = Nothing
Set myItem = Nothing
End Sub