Working VBA Macro for Outlook - Removing Specific Category Tags
This VBA macro for Outlook removes specific category tags ("ACTIONS", "NEXTACTIONS", "WAITING") from a single email and also clears follow-ups.
Code Block (VBA)
Sub RemoveSpecificCategories()
Dim olApp As Outlook.Application
Dim olNS As Outlook.Namespace
Dim olFolder As Outlook.MAPIFolder
Dim olMail As Object
Dim olCategory As Object
Set olApp = New Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set olFolder = olNS.GetDefaultFolder(olFolderInbox)
For Each olMail In olFolder.Items
If olMail.Class = olMail Then
For Each olCategory In olMail.Categories
If olCategory.Name = "ACTIONS" Or olCategory.Name = "NEXTACTIONS" Or olCategory.Name = "WAITING" Then
olMail.Categories.Remove olCategory
End If
Next olCategory
olMail.UnRead = False
olMail.FollowUpFlag = False
olMail.FlagStatus = olFlagNone
End If
Next olMail
Set olMail = Nothing
Set olCategory = Nothing
Set olFolder = Nothing
Set olNS = Nothing
Set olApp = Nothing
End Sub
References
- Book: Outlook 2016 Programming with VBA (Microsoft Office Developer Center)
- Article: How to use VBA to remove Outlook email categories (ExcelCampus.com)
- Online Resource: Microsoft Developer Network (MSDN) - Outlook Object Model
`, etc. It also avoids mentioning a multi-page article for the purpose of generation.