Pass a reference to the form from the Excel project to the dll.
' in Excel
dim frm as userform1
set frm = new userform1
set gVB6cls = new myVB6App.myClass
Set gVB6cls.objFrm = frm ' Public objFrm as Object
frm.show
Or maybe declare gVB6cls in the form and in the form's initialize event
set gVB6cls = new myVB6App.myClass
Set gVB6cls.objFrm = Me
In the myVB6App.myClass's initialize event set a global reference to self,
eg
Set gCls = Me
Also include something like this
Public Sub Bye()
' be sure to call this externally before destroying the class
set gCls = nothing
end sub
Now anywhere in your VB6 app you can refer to gCls.objFrm and
gCls.objFrm.myControl
In the form's unload event first call gVB6cls.Bye
then
Set gVB6cls = nothing
FWIW you can start your Excel form from VB6 using xlApp.Run, say to call a
procedure to load the userform and do the above.
Instead of passing the userform, objFrm, maybe it might be better to pass
references to the controls you know you will want to handle in the VB6 app.
In the VB6 you can't do -
Dim objFrm as Userform1
but you might be able to do
Dim myCtrl as ControlType ' ie early binding
Regards,
Peter T