Many users wish Outlook to auto assign a specific color category to a meeting when they accept it. At present, this article will expose a piece of VBA code to achieve it with effortless ease.
To classify and highlight the accept meetings in the Outlook calendar, you may be used to assigning a specific color category to such meetings. In comparison with manually category assignment, which is a bit troublesome, you must prefer to let Outlook auto accomplish it. Therefore, in the followings, we will share you a way in detail.
Auto Assign a Specific Color Category to a Meeting after Accepting It
- For a start, launch Outlook application.
- Then, trigger Outlook VBA editor according to “How to Run VBA Code in Your Outlook“.
- Subsequently, put the following VBA code into “ThisOutlookSession” project.
Public WithEvents objSentFolder As Outlook.Folder Public WithEvents objSentItems As Outlook.Items Private Sub Application_Startup() Set objSentFolder = Outlook.Application.Session.GetDefaultFolder(olFolderSentMail) Set objSentItems = objSentFolder.Items End Sub Private Sub objSentItems_ItemAdd(ByVal Item As Object) Dim objMeetingItem As Outlook.MeetingItem Dim objMeetingAcceptance As Outlook.MeetingItem Dim objMeeting As Outlook.AppointmentItem 'If a meeting acceptance item arrives in "Sent Items" folder If TypeOf Item Is MeetingItem Then Set objMeetingItem = Item If Left(objMeetingItem.Subject, 9) = "Accepted:" Then Set objMeetingAcceptance = objMeetingItem 'Get the corresponding meeting in Calendar Set objMeeting = objMeetingAcceptance.GetAssociatedAppointment(True) 'Assign a specific color category to the meeting objMeeting.Categories = objMeeting.Categories & "Yellow Category" objMeeting.Save End If End If End Sub
- Next, change “Yellow Category” to your desired color category name.
- After that, restart your Outlook application to trigger this macro.
- Eventually, you can have a try.
- First off, open a meeting which you haven’t responded to.
- Then, click “Accept” and select “Send the Response Now” option.
- After the meeting acceptance response is sent, the specific color category will be assigned to the corresponding meeting at once.
Take Care of Your Outlook File
Outlook PST file is vulnerable. Thus, you have to keep careful of your Outlook file. For instance, you need clean up the old and useless Outlook items to ensure that Outlook file is in small size. And you have to beware of the suspicious emails from unknown senders in that these emails may contain viruses or malware which can directly result in Outlook corruption. It is admittedly difficult to restore damaged Outlook data unless you resort to remarkable Outlook recovery software, such as DataNumen Outlook Repair.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including SQL Server fix and outlook repair software products. For more information visit www.datanumen.com