ThisWorkbookからUserFormにクラスオブジェクトを渡すにはどうすればよいですか?
以下のエラーが表示されます。
ThisWorkbookで:
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