Hello newsgroup,

I have a simple Class module called TestClass that defines an array
property:
TestClass.cls:
Private InternalArray(0) As Double

Public Property Get MyArray() As Double()
  MyArray = InternalArray
End Property

Public Property Let MyArray(NewValue() As Double)
  InternalArray(0) = NewValue(0)
End Property

In some other module I have the following code:

Function FunctionReturningArray() As Double()
  Dim Retval(0) As Double
  Retval(0) = 42#
  FunctionReturningArray = Retval
End Function

Sub test()
  Dim a As New TestClass
  a.MyArray = FunctionReturningArray ' WORKS!

  Dim b(0) As Double
  b = FunctionReturningArray ' Gives error: Cannot assign arrays.
                                           ' That is quite expected.

  a.MyArray = b ' Gives error: Cannot assign arrays. WHAT???
End Sub

Can anybody explain why it is impossible to access the property
MyArray directly?

Thanks in advance,
Stuart

PS: I'm using VB6.0 inside Excel 2003 (don't know about any service
packs).

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,800 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe

Reply via email to