Perhaps you’re accustomed to setting all items in your Outlook calendar to “Busy”. However, after an item becomes overdue, you may wish Outlook to automatically change its status to “Free”. This article will assist you to achieve it with VBA.
Outlook provides a feature, which can permit you to set the busy/free status for calendar items, namely meetings or appointments. When creating new calendar items, you may be used to setting them to “busy”. In this scenario, maybe you also hope that a calendar item can be changed to “Free” once it becomes overdue, only keeping the future items in “Busy” status. This can be realized by the following way.
Auto Change the Overdue Calendar Items to “Free” Status
- At the very beginning, launch Outlook application.
- Then, open VBA editor via “Alt + F11” key shortcuts.
- In the new window, put the VBA code below into the “ThisOutlookSession” project.
'Auto run this macro on startup Private Sub Application_Startup() Call ChangeOverdueCalendarItemsToFree End Sub Sub ChangeOverdueCalendarItemsToFree() Dim objStore As Outlook.Store Dim objFolder As Outlook.Folder For Each objStore In Application.Session.Stores For Each objFolder In objStore.GetRootFolder.Folders If objFolder.DefaultItemType = olAppointmentItem Then Call ProcessFolders(objFolder) End If Next Next End Sub Sub ProcessFolders(ByVal objCurrentFolder As Outlook.Folder) Dim objItem As Object Dim objAppointment As Outlook.AppointmentItem Dim objSubfolder As Outlook.Folder For Each objItem In objCurrentFolder.Items If objItem.Class = olAppointment Then Set objAppointment = objItem 'Find overdue items If (objAppointment.Start < Now) And (objAppointment.End < Now) Then 'Change to "Free" objAppointment.BusyStatus = olFree objAppointment.Save End If End If Next 'Process all folders recursively If objCurrentFolder.Folders.Count > 0 Then For Each objSubfolder In objCurrentFolder.Folders Call ProcessFolders(objSubfolder) Next End If End Sub
- After that, restart your Outlook, which will activate this new macro right now.
- At present, you can access the calendar folders in your Outlook to check the status of overdue calendar items.
- You will see that all the overdue calendar items have been changed to “Free”, like the following screenshot.
Restore Outlook from Crash
From time to time, you may encounter Outlook crash, including “not responding”, sudden shutdown and so on. At best, a simple restart is able to get Outlook back to its original status. Nevertheless, there are chances that you will suffer serious cases, such as an error message prompting inaccessible Outlook file. At that time, maybe Scanpst, the inbox fix tool, will not make effects. Thus, you have no choice but to resort to a more powerful utility, 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 recover Sql Server and outlook repair software products. For more information visit www.datanumen.com