philhost.blogg.se

Outlook 2016 reminders always on top
Outlook 2016 reminders always on top













  1. #OUTLOOK 2016 REMINDERS ALWAYS ON TOP UPDATE#
  2. #OUTLOOK 2016 REMINDERS ALWAYS ON TOP CODE#

SetWindowPos hRemWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS ' Set Modal If hRemWnd = 0 Then hRemWnd = FindReminderWindow(100) Public Sub TriggerEvent(ByVal hWnd As Long, ByVal uMsg As Long, ByVal idevent As Long, ByVal Systime As Long) If TimerID = 0 Then TimerID = SetTimer(0, 0, Seconds * 1000, AddressOf TriggerEvent)ĭim Success As Long: Success = KillTimer(0, TimerID) If TimerID 0 Then Call DeactivateTimer 'Check to see if timer is running before call to SetTimer Public Sub ActivateTimer(ByVal Seconds As Long) 'The SetTimer call accepts milliseconds Public hRemWnd As Long 'Store the handle of the reminder window Private Function FindReminderWindow(iUB As Integer) As VariantįindReminderWindow = FindWindowA(vbNullString, "1 Reminder") SetWindowPos ReminderWindowHWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS ReminderWindowHWnd = FindReminderWindow(10) Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent _ Private Sub Application_Reminder(ByVal Item As Object)

#OUTLOOK 2016 REMINDERS ALWAYS ON TOP CODE#

If you routinely have a larger number of reminders than 10 popup then you could increase this number in the EventMacro sub.Īdd the following code to the 'ThisOutlookSession' module Private Sub Application_Startup()Ĭall ActivateTimer(60) 'Set timer to go off every 60 seconds The FindReminderWindow function takes a value which is the number of iterations to step through to find the window. This now works for me in 2013 and should work for versions below 2013. I have now updated it with a further function (FindReminderWindow) that looks for a range of popup reminder captions.

#OUTLOOK 2016 REMINDERS ALWAYS ON TOP UPDATE#

UPDATE 2 (Sep 4, 2015): Having transitioned to Outlook 2013 - this code stopped working for me. It's a massive hassle as you're writing an e-mail.Īs such I upgraded the code so that the timer only runs every 60 seconds then upon finding the first active reminder, the timer is stopped and the secondary event function is then used forthwith to activate the window focus change.

outlook 2016 reminders always on top

UPDATE (Feb 12, 2015): after using this for a while I found a real annoyance with the fact that triggering the timer removes the focus from the current window. So that's it every 5 seconds, the timer checks whether a window with a caption "1 Reminder" exists then bumps it to the top.

outlook 2016 reminders always on top

If ReminderWindowHWnd 0 Then SetWindowPos ReminderWindowHWnd, _ ReminderWindowHWnd = FindWindowA(vbNullString, "1 Reminder") Public Sub TriggerTimer(ByVal hwnd As Long, ByVal uMsg As Long, _īyVal idevent As Long, ByVal Systime As Long) If TimerID = 0 Then MsgBox "The timer failed to activate." TimerID = SetTimer(0, 0, nSeconds, AddressOf TriggerTimer) 'Check to see if timer is running before call to SetTimer 'The SetTimer call accepts milliseconds, so convert from seconds Public Sub ActivateTimer(ByVal nSeconds As Long) ' If the timer ID 0 then the timer is running Public TimerID As Long 'Need a timer ID to eventually turn off the timer. Private Const FLAGS As Long = SWP_NOMOVE Or SWP_NOSIZE HWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, _īyVal cy As Long, ByVal wFlags As Long) As Long Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal _ Private Declare Function FindWindowA Lib "user32" (ByVal lpClassName _Īs String, ByVal lpWindowName As String) As Long Then added a module and added the following code Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent _Īs Long, ByVal uElapse As Long, ByVal lpTimerfunc As Long) As Longĭeclare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent _ If TimerID 0 Then Call DeactivateTimer 'Turn off timer upon quitting Then melding the two solutions together gave a working solution to this problem.įrom the trust centre, I enabled the use of macros then opening the visual basic editor from Outlook (alt+F11) I added the following code to the 'ThisOutlookSession' module Private Sub Application_Startup()Ĭall ActivateTimer(5) 'Set timer to go off every 5 seconds Taking the code from the following website Outlook VBA - Run a code every half an hour To get around this, I looked to employ a timer to periodically test if the window was present and if it was, then bring it to the front. based on the code I assumed this was because the window wasn't detected until it had instantiated once However as noted in the comments, the first reminder failed to popup while further reminders then did. * For the latest macro please see update 3 *Īfter searching for a while I found a partial answer on a website that seemed to give me the majority of the solution















Outlook 2016 reminders always on top