Friday, June 27, 2014

Restore Reminder popup in Outlook 2010





http://www.codingeverything.com/2013/05/making-sure-outlook-calendar-reminders.html#StepNumberFive


Here's the formatted script

'Declare Functions From User32 Library
Private Declare PtrSafe Function FindWindowA Lib "user32" _
    (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare PtrSafe Function SetWindowPos Lib "user32" ( _
    ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
    ByVal X As Long, ByVal Y As Long, ByVal cx As Long, _
    ByVal cy As Long, ByVal wFlags As Long) As Long


'Declare Constants
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const FLAGS As Long = SWP_NOMOVE Or SWP_NOSIZE
Private Const HWND_TOPMOST = -1

'Finds Reminder Window and Brings to TopMost position
Private Sub Application_Reminder(ByVal Item As Object)
    Dim ReminderWindowHWnd As Variant
    Dim cnt As Long
    On Error Resume Next
    cnt = 1
    Do Until (cnt > 20 Or ReminderWindowHWnd <> 0)
        ReminderWindowHWnd = FindWindowA(vbNullString, cnt & " Reminder(s)")
        cnt = cnt + 1
    Loop
    'bring reminder window to front
    SetWindowPos ReminderWindowHWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS
End Sub