The short explanation is: You should not do callback from
VB into XL.
i.e. when you have an XL addin that uses an
VB DLL, the
VB DLL should
not use custom procedures or custom classes inside XL, this is an
important design issue.
This said, it is possible to do this, but with class modules this
becomes very tricky. With Userforms i'm not even surer that this is
possible without the following Hack(use at your own risk)
In the XL addin set the following Macro:
Public Function LoadUserForm(varForm As Variant) As Object
Set LoadUserForm = VBA.UserForms.Add(varForm)
' see this reference is not available outside the XL VBA project!!!! so
no way of opening an Userform from
VB directly
End Function
in yout
VB Code
Sub Main(myapp as Workbook)
Dim XL as Excel.Application
Set XL = myapp.parent
XL.run (myapp.name &"!LoadUserForm","UserForm1").UFTest
' runs the form with helper function in XL addin.
End SUb
Dm Unseen