View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Userform.Caption is blank when reference passed to class

A generic userform object has very few properties. Most
properties are created when the form is created.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"NickHK" wrote in message
...
'** In MyClass.cls
Private XLUForm As UserForm
Public Property Set XLUserForm(vData As UserForm)
Set XLUForm = vData
End Property

'**Called from a userform called MyForm
Set MyClass.XLUForm=MyForm

Using the above code in a class in same WB as the passed
UserForm,
vData.Caption always evaluates to "".
But if, whilst in the class, I test ?MyForm.Caption it returns
the correct
value.
Also, properties like vData.Width are no longer "supported",
but
.InsideWidth is.

If I change the declarations to:
Private XLUForm As MyForm
Public Property Set XLUserForm(vData As MyForm)

everything is *normal*.

Anyone explain why ?

NickHK