Problem display form from COM addin

  • Thread starter Thread starter johan
  • Start date Start date
J

johan

In som environments I get an error when I try to display a user form
from a VB6 com addin in Outlook.

Run-time error '406':

Non-modal forms cannot be displayed in this host application from an
ActiveX DLL, ActiveX Control, or Property Page.


The code adds a button to the Standard toolbar. The eventhandler for
the button loads och show the user form.

Since the form has no parent window, I dont think it's posible to
display it as a modal form.

The code works just fine on some machines. I'm using Outlook 2003.

Please help!
 
You can display any form modally even without an owner argument. It might
not end up at the top of the z-order unless you massage the z-order but you
certainly can do it.

You could also get the main Outlook window and use the hWnd for that to set
the owner of the form but you'd need to use the Win32 API's to do that with
no parent form, not pure VB code.

I'd also look into exactly what the differences are between the environments
where what you're doing works and where it doesn't work.

What sort of Inspector are you adding the button to: Outlook editor email,
WordMail, appointment, etc.?
 
Back
Top