If you think that you’ve wasted too much time in dealing with the stack of Outlook emails, you may want to get and track the accurate time you spend on each email. In this article, we will teach you to use VBA code to achieve it in Outlook journal.
So as to speed up their dealing with the pile of Outlook emails to improve their work efficiency, some users hope to track and record how much time they spend on each email in their Outlook. This requirement demands a timer. Fortunately, Outlook has such a “Timer” feature in journal item. Now, we’ll teach you how to let Outlook auto activate the “Timer” when you open an email and prompt you of the exact time you spend when you close this email.
Auto Track the Time You Spend on Each Email
- To start with, launch your Outlook program.
- Then in the Outlook main window, you could switch to “Developer” tab and hit the “Visual Basic” button.
- Next you will get access to Outlook VBA editor window.
- At this point, you should find and open the “ThisOutlookSession” project.
- Subsequently, copy and paste the VBA code below into this project window.
Public WithEvents objInspectors As Outlook.Inspectors Public WithEvents objMail As Outlook.MailItem Public WithEvents objJournal As Outlook.JournalItem Private Sub Application_Startup() Set objInspectors = Outlook.Inspectors End Sub Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector) If TypeOf Inspector.CurrentItem Is MailItem Then Set objMail = Inspector.CurrentItem End If End Sub 'When you open an email Private Sub objMail_Open(Cancel As Boolean) Set objJournal = Outlook.Application.CreateItem(olJournalItem) 'Start the timer in a journal item With objJournal If objMail.Subject = "" Then .Subject = "Compose New Mail" Else .Subject = "Deal with: " & objMail.Subject End If .Type = "Email-Message" .StartTimer End With End Sub 'When this email is being closed Private Sub objMail_Close(Cancel As Boolean) Dim strMsg As String 'Stop the timer in the journal item 'Save this journal item With objJournal .Attachments.Add objMail .Body = objMail.Body .StopTimer .Save '.Display ==> display this journal End With strMsg = objJournal.Duration & " minute(s) spent on " & Chr(34) & objMail.Subject & Chr(34) & "!" If objJournal.Duration <= 5 Then MsgBox strMsg, vbInformation + vbOKOnly, "Timer" Else MsgBox strMsg & vbCrLf & "You should speed up your work on emails!", vbExclamation + vbOKOnly, "Timer" End If End Sub
- After that, you ought to sign this macro. Click “Tools” > “References” and then follow the onscreen instructions to accomplish it.
- Later you can restart your Outlook to activate this VBA project.
- From now on, every time when you open an email, the timer in a journal item will start. And when you close this email. The timer will stop automatically.
- Also, you will get a message prompting the time you spend on this email.
- If the time is within 5 minutes, it will look like the following screenshot:
- If the time exceeds 5 minutes, it will be shown as the image below:
Salvage Your Outlook Data
Even though Outlook is well known for its quantities of capabilities, it still cannot keep far away from errors. And in worse situations, Outlook may crash abruptly. Once you meet crashes, your Outlook cherished data will be at risk. Hence, you should make sufficient precautions, such as making regular backups and keeping a PST repair utility handy, like DataNumen Outlook Repair. It can scan and repair Outlook within minutes.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including damaged mdf and outlook repair software products. For more information visit www.datanumen.com