I'd like to make sure Reminders in Outlook 2010 actually pop up when they are fired.
I'm working on a cleaner implementation than the one discussed in the SE question How to make Outlook Calendar reminders stay on top in Windows 7
I'm having finicky results when calling the Activate
method, which should activate an inspector window by bringing it to the foreground and setting keyboard focus.
I'm calling Activate
on what should be the Reminder Inspector item. This is not an issue with calling Application.ActiveWindow
, which returns nothing if no Outlook explorer or inspector is open, because I'm handling for nulls and displaying a message box in the event it can't find anything.
'ensures all reminder notices receive focus
Private Sub Application_Reminder(ByVal Item As Object)
If TypeOf Item Is AppointmentItem Then
If Not (Application.ActiveWindow Is Nothing) Then
Dim myOutlook As Object
Set myOutlook = GetObject(, "Outlook.Application")
If myOutlook.ActiveWindow.WindowState = olMinimized Then
'This works fine
Application.ActiveExplorer.Activate
Else
'This call won't set window ontop
Application.ActiveExplorer.Activate
End If
End If
End If
End Sub
When the code calls Activate
, if outlook is minimized the activated window will be pulled to the front and receive focus, but if it's in open in the background it won't.
Do I really have no other option than to call user32 in order to set the z-index of the alert window?