Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1805
  • Last Modified:

Automated countdown in outlook calendar?

Experts,
I've finally set my last day in my current job (congratulations to me!), and I want to put a daily countdown in my Outlook Calendar (Office Prof. Ed. 2003 - 11.5608.5606). Ideally I would get a "XX work days left!" when I open outlook each morning. Work days vs. regular days not terribly important.

Clearly I can do this manually, but some sort of automation would be great! TIA!
0
goldband
Asked:
goldband
  • 2
1 Solution
 
David LeeCommented:
Hi goldband,

do you want it to appear as an event at the top of the daily calendar?

Cheers!
0
 
goldbandAuthor Commented:
That would be perfect!
0
 
David LeeCommented:
Here's the code for doing this.  Follow these intstructions to use it.

1.  Start Outlook
2.  Click Tools->Macro->Visual Basic Editor
3.  If not already expanded, expand Modules and click on Module1
4.  Copy the code below and paste it into the right-hand pane of the VB Editor
5.  Edit the code as needed.  I placed a comment before each line that needs to be edited
6.  Click the diskette icon on the toolbar to save the changes
7.  Close the VB Editor
8.  Click Tools->Macro->Security
9.  Change the Security Level setting to Medium
10.  Run the macro.  Don't run it more than once or you'll end up with duplicate events.


Sub Countdown()
    Dim olkEvent As Outlook.AppointmentItem, _
        datDeparture As Date, _
        intDaysToGo As Integer, _
        intCounter As Integer
    'Enter your departure date on the following line
    datDeparture = #5/1/2006#
    intDaysToGo = DateDiff("d", Date, datDeparture)
    For intCounter = intDaysToGo To 0 Step -1
        Set olkEvent = Application.CreateItem(olAppointmentItem)
        With olkEvent
            'Edit the event subject ont he following line
            .Subject = IIf(intCounter = 0, "Last Day", intCounter & IIf(intCounter = 1, " day ", " days ") & "till I depart")
            .Start = datDeparture - intCounter
            .AllDayEvent = True
            .ReminderSet = False
            .Save
        End With
    Next
    Set olkEvent = Nothing
End Sub
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now