Quantcast
Channel: Coding Everything
Viewing all articles
Browse latest Browse all 25

Making Sure Outlook Calendar Reminders Actually Pop-up in Windows 7

$
0
0

Introduction

In Windows 7, MS Outlook seems to be horribly bad at popping up calendar reminders when outlook doesn’t have focus. This can cause a series of problems from minor annoyances to missed meetings. As discussed in this StackExchange question, there are some relatively easy work arounds to this issue that I’ll elaborate on here. If you’ve never used Outlook’s VBA editor to extend it’s capabilities before, this article will take you through how to set up everything you’ll need to do, start to finish. If you’re already familiar with using VBA in Outlook, then you can just skip to Step 5 and paste in the code and you’ll be all set.

Step By Step

  • 1) Hit the Windows Key and type “certificate”
  • 2) Select Digital Certificate for VBA Projects and type in a name for your certificate and hit OK
  • 3) Open Outlook 2010 and Hit Alt + F11 to start the VBA editor
  • 4) In the Project Pane on the left, Expand Project1> Microsoft Outlook Objects> and double click on ThisOutlookSession
  • 5) Paste in the following code exactly:
'ensures all reminder notices receive focus
PrivateSub Application_Reminder(ByVal Item AsObject)
IfTypeOf Item Is AppointmentItem Then
Application.ActiveWindow.Activate
EndIf
EndSub

Edit: Added New Better Code Below:

'Declare Functions From User32 Library  
PrivateDeclare PtrSafe Function FindWindowA Lib"user32" _
(ByVal lpClassName AsString, _
ByVal lpWindowName AsString) AsLong
PrivateDeclare PtrSafe Function SetWindowPos Lib"user32" _
(ByVal hwnd AsLong, _
ByVal hWndInsertAfter AsLong, _
ByVal X AsLong, _
ByVal Y AsLong, _
ByVal cx AsLong, _
ByVal cy AsLong, _
ByVal wFlags AsLong) AsLong

'Declare Constants
PrivateConst SWP_NOSIZE = &H1
PrivateConst SWP_NOMOVE = &H2
PrivateConst FLAGS AsLong = SWP_NOMOVE Or SWP_NOSIZE
PrivateConst HWND_TOPMOST = -1

'Only show the message the first time
Private messageAlreadyShown AsBoolean

'Finds Reminder Window and Brings to TopMost position
PrivateSub Application_Reminder(ByVal Item AsObject)
OnErrorResumeNext

'show message box for first reminder
IfNot messageAlreadyShown Then
MsgBox "First Reminder", vbSystemModal, ""
messageAlreadyShown = True
EndIf

'find reminder window
ReminderWindow = FindWindowA(vbNullString, "1 Reminder")
'bring reminder window to front
SetWindowPos ReminderWindow, HWND_TOPMOST, 0, 0, 0, 0, FLAGS
EndSub
  • 6) Sign the Macro by going to Tools > Digital Signature and clicking Choose
  • 7) Select the certificate you created earlier and hit OK
  • 8) Select OK again, hit Ctrl + S to save and exit the VBA window
  • 9) To Enable Macros, Go to File > Options and select Trust Center from the left window
  • 10) Run the Trust center by clicking the Trust Center Settings button on the right.
  • 11) From the Trust Center, select Macro Settings, and select “Notifications for digitally signed macros, all other macros disabled” and hit OK
  • 12) Exit Outlook - It will ask you if you want to save the project, click Yes
  • 13) Start Outlook - It will give you a security notice. Select “Trust all documents from this publisher” (You can first confirm that you are the publisher by selecting “Show Signature Details”)
  • 14) That’s it! You’re all set. You never have to touch any of that code again or miss another meeting (unintentionally)

UPDATE!

I’ve update the code to use ActiveWindow instead of ActiveExplorer, which returns nothing“if no explorer is active.” Thanks to CW for the impetus to update my code.


Viewing all articles
Browse latest Browse all 25

Trending Articles