Click here to Skip to main content
13,356,318 members (67,790 online)
Click here to Skip to main content
Add your own
alternative version


2 bookmarked
Posted 6 Mar 2014

Fixing the Time Bar on Outlook 2013 Calendar

, 6 Mar 2014
Rate this:
Please Sign up or sign in to vote.
Outlook 2013 does not advance the current time in the calendar view; here is a hack fix.


In Outlook 2013, there is a blue line that highlights the current time in calendar view. However, if you are on another window, say word or another browser, etc., the time line does not update and if you look over at your 2nd monitor where the calendar is, you will see an incorrect time if you are looking at your calendar. This has been bothering me for a long time and I finally got around to finding / hacking a fix.

See the following article where others had the same problem.


I got the basic premise of the solution/hack from the following article which provides a timer that runs a piece of code every minute in Outlook. The trick was to find some Outlook code that I could insert into the timer function that would update the time bar. As it turns out, the CalendarView.Save method does this. One potential side effect I can think of is if you change your calendar view but did not intend to save that view, it will get saved every minute by this hack.

Using the Code

Insert the following code in the ThisOutlookSession module. You can do this by showing the developer ribbon on the menu. Then selecting the developer ribbon/ Visual Basic on the far left of the ribbon.

In the application section, insert the following code. You can open up 'ThisOutlookSession' which opens up the correct source code file. Make sure the application is selected on the upper left hand drop down box.

Private Sub Application_Quit()
  If TimerID <> 0 Then Call DeactivateTimer 'Turn off timer upon quitting **VERY IMPORTANT**
End Sub

Private Sub Application_Startup()
  MsgBox "Activating the Timer."
  Call ActivateTimer(1) 'Set timer to go off every 1 minute
End Sub

Then insert a new module by right clicking on Modules and select Insert/Module. Add the following code in that source file.

Declare Function SetTimer Lib "user32" _
(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerfunc As Long) As Long
Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long

Public TimerID As Long 'Need a timer ID to eventually turn off the timer. 
                       'If the timer ID <> 0 then the timer is running

Public Sub ActivateTimer(ByVal nMinutes As Long)
  nMinutes = nMinutes * 1000 * 60 'The SetTimer call accepts milliseconds, so convert to minutes
  If TimerID <> 0 _
  Then Call DeactivateTimer 'Check to see if timer is running before call to SetTimer
  TimerID = SetTimer(0, 0, nMinutes, AddressOf TriggerTimer)
  If TimerID = 0 Then
    MsgBox "The timer failed to activate."
  End If
End Sub

Public Sub DeactivateTimer()
Dim lSuccess As Long
  lSuccess = KillTimer(0, TimerID)
  If lSuccess = 0 Then
    MsgBox "The timer failed to deactivate."
    TimerID = 0
  End If
End Sub

Public Sub TriggerTimer(ByVal hwnd As Long, _
ByVal uMsg As Long, ByVal idevent As Long, ByVal Systime As Long)
  'MsgBox "The TriggerTimer function has been automatically called!"
   Dim objView As CalendarView
 Dim o As Explorer
 For Each o In Application.Explorers
    If o.CurrentView.ViewType = olCalendarView Then
        Set objView = o.CurrentView
    End If
 Next o
End Sub

Points of Interest

Note that this code should update multiple calendars if you have multiple open. I didn't spend a lot of time playing around with the code in TriggerTimer to see if another method would update the time bar. It could be there is a better method to call that doesn't have any side effects.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

United States United States

You may also be interested in...

Comments and Discussions

Questioncompiling error Pin
Member 131731154-May-17 10:14
memberMember 131731154-May-17 10:14 
SuggestionNote: To enable this macro, you must enable macros Pin
Rex Schrader2-Jun-14 8:08
memberRex Schrader2-Jun-14 8:08 
GeneralMy vote of 5 Pin
Rex Schrader15-May-14 12:25
memberRex Schrader15-May-14 12:25 
Question64 bit version of code Pin
micky_r_de9-Apr-14 5:18
membermicky_r_de9-Apr-14 5:18 
AnswerRe: 64 bit version of code Pin
bradyguy16-May-14 6:42
memberbradyguy16-May-14 6:42 
AnswerRe: 64 bit version of code Pin
Member 109230253-Jul-14 10:38
memberMember 109230253-Jul-14 10:38 
GeneralRe: 64 bit version of code Pin
Kris Walsh14-Aug-14 12:03
memberKris Walsh14-Aug-14 12:03 
GeneralMessage Closed Pin
7-Mar-14 1:51
memberAsha Roy7-Mar-14 1:51 
Generalchanges look good Pin
bradyguy6-Mar-14 12:17
memberbradyguy6-Mar-14 12:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.180111.1 | Last Updated 6 Mar 2014
Article Copyright 2014 by bradyguy
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid