I've been working in fullscreen RDP sessions recently and miss having Outlook tell me when I've received e-mails or when the Friday afternoon pub session is about to start.
I had assumed that a quick call to
SetWindowPos in response to a
ThisOutlookSession event would suffice.
The events occurs BEFORE the window has been created and displayed so the tricky part here is to use Windows timers to wait a while before executing the
Using the Code
- Open Outlook
- Open the VBA IDE (Alt-F11)
- Unzip the attached file to import the class, module and form definitions
- You will now have an extra '
ThisOutlookSession' class under 'Class Modules'
Move/merge the code in there into the '
ThisOutlookSession' class definition under 'Microsoft Office Outlook Objects'
- Your project should now look something like this:
Enable the 'New Mail Alerts' Dialog
Now, you have all the code you need to ensure that you're getting e-mail alerts.
- In Outlook 2013, look under 'File' for 'Rules and Alerts':
- Check that the 'New Mail' rules is enabled:
- ... or create a rule that displays the 'New mail' window when required.
Because you've added code to the Outlook Session, you will now be prompted to enable macros each time you run Outlook:
To overcome this, you could create a certificate for your workstation and sign your VBA project with it.
Points of Interest
mdlExecutor module is an example of a generic way to fire 'actions' after a period of time using the
IAction is the interface used by the
mdlExecutor module and
TMakeTopmostAction is a simple example of how it's possible to define an interface (in this case
IAction) and implement it elsewhere.
- v0.1: Initial draft
- v0.2: Corrected image urls
- v0.3: Only change the alert Window's style if it needs changing
NOTE: Mail alert windows seem to perisist while appointment windows are re-created.