Is This Content Helpful?
We're glad to know this article was helpful.
When attempting to show a modeless form implemented within a Visual Basic ActiveX DLL, the following error may occur:
Error: Non-modal forms cannot be displayed in this host application from an ActiveX DLL, ActiveX Control, or Property page
At ArcGIS 9.x, Visual Basic for Applications (VBA) is not automatically initialized when ArcGIS applications start. It is only initialized if there is at least one VBA subroutine that handles an event; for example, any document event or those events associated with UI Controls. The change was made as part of an overall effort to improve the performance and resource utilization of ArcGIS. At ArcGIS 9.x, many subsystems such as extensions, toolbars and dockable windows are now loaded only when they are needed.
Deferring the initialization of VBA when an ArcGIS application starts can cause modeless forms implemented in Visual Basic ActiveX DLLs to fail, since they rely on VBA being fully initialized for modeless support to be enabled. When an attempt is made to show a VB dialog modelessly, it fails.
Microsoft documents a known issue where modeless forms in Visual Basic ActiveX DLLs should not be utilized to display modelessly. More information is available in the Related Information section below. VB modeless forms also suffer from other problems such as focus and z-order nonconformities. Modeless forms implemented in other development environments including C++, C#, Delphi and VB.NET do not suffer from this problem.
Instead of requiring that all users load VBA at application startup in anticipation that a VB modeless form may be required, the following solutions are available to allow modeless forms in Visual Basic ActiveX DLLs to appear.
Warning: The instructions below include making changes to essential parts of your operating system. It is recommended that you backup your operating system and files, including the registry, before proceeding. Consult with a qualified computer systems professional, if necessary. Esri cannot guarantee results from incorrect modifications while following these instructions; therefore, use caution and proceed at your own risk.