Frequently, Outlook developers need to display a formular to a user to request some data while the user is working on an e-mail.
There's a problem if Word is used as e-mail editor: Your Addin or VBA code runs in the process of Outlook while the e-mail editor runs in the process of Word. That means for instance, you cannot show your formular modal to the mail window; without tricks you even cannot get the mail window on top or give it the focus.
Dr. Jürgen Thümmler provides the DLL dsmodal for free: With that you can easily make any window modal to a window of an other process or even make it modal to all the system.
This sample demonstrates how to obtain the window handles and use dsmodal. Please copy the dsmodal.dll into the system directory (..\winnt\system32) so that it will be found.
The sample uses a VB6 formular. Before loading it, please set the ParentWindowCaption to the caption of the mail window (Inspector.Caption).
With a few changes you can also use it in VBA code. Because the UserForm of the Office library doesn't know the Form_Load event, you could call the code e.g. once in the Inspector_Activate event. Additionally, the UserForm doesn't have a property for its window handle. But with its caption property and the FindChildWindowText function you can get the handle easily.