Hello everybody,
I created an ActiveX .exe project using Visual Basic 6.0. In this project I have added an MDI parent form.
I have a class in my project named CMain. This is the main class. In order to create my application from, for example, Excel, one should use the following code:
Dim Main As New MyActiveXEXE.CMain
In my project, in the Initialize event of the CMain class I have added the code:
Set MDIForm = New frmMDIParent
MDIForm here is a member of the CMain class. When an instance of the class CMain is created, a new MDI parent form should be shown, this was my idea. But when in Excel I try to create a CMain class object, Visual Basic would not allow me to create an MDIParent form, saying "Only one MDI form allowed". The problem goes away only if instead of writing Set MDIForm = New frmMDIParent I just write Load frmMDIParent. But in this case I get only one copy of a parent MDI form, irrespective of the number of CMain objects I created.
So I want a simple thing: I want an ActiveX .exe with a parent MDI form, so that when in Excel I write Dim Main As New MyActiveXEXE.CMain I get as many parent MDI forms as I wish.
Please, help me.
P. S. There is one another interesting thing I have discovered. In an ActiveX .exe, variables that are situated in a simple module are SHARED between all instances of the class (CMain in my example). If you don't know that, strange errors appear!
I created an ActiveX .exe project using Visual Basic 6.0. In this project I have added an MDI parent form.
I have a class in my project named CMain. This is the main class. In order to create my application from, for example, Excel, one should use the following code:
Dim Main As New MyActiveXEXE.CMain
In my project, in the Initialize event of the CMain class I have added the code:
Set MDIForm = New frmMDIParent
MDIForm here is a member of the CMain class. When an instance of the class CMain is created, a new MDI parent form should be shown, this was my idea. But when in Excel I try to create a CMain class object, Visual Basic would not allow me to create an MDIParent form, saying "Only one MDI form allowed". The problem goes away only if instead of writing Set MDIForm = New frmMDIParent I just write Load frmMDIParent. But in this case I get only one copy of a parent MDI form, irrespective of the number of CMain objects I created.
So I want a simple thing: I want an ActiveX .exe with a parent MDI form, so that when in Excel I write Dim Main As New MyActiveXEXE.CMain I get as many parent MDI forms as I wish.
Please, help me.
P. S. There is one another interesting thing I have discovered. In an ActiveX .exe, variables that are situated in a simple module are SHARED between all instances of the class (CMain in my example). If you don't know that, strange errors appear!