如何将 ThisWorkbook 中的类对象传递给 UserForm?
我收到以下错误:
在本工作簿中:
Dim MainObject As MyClass
Set MainObject = New MyClass
Public Sub ShowMyForm()
Dim frmMyForm as MyForm
Set frmMyForm = New MyForm
frmMyForm.FormObject = MainObject ' *<-- Run-time Error '13': Type mismatch*
End Sub
在MyForm中:
Private p_Object As MyClass
Property Get FormObject() As MyClass
Set FormObject = p_Object
End Property
Property Set FormObject(ByRef Value As MyClass)
Set p_Object = Value
End Property