LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Question: Can't pass an Array to a class

Hello

I am struggling to pass an array to a class. Basically I defined the
class as follows:

Public xVar As Integer
Public Property Let AddtheStuff(TheStuff() As Integer)
Dim i As Integer
For i = LBound(TheStuff) To UBound(TheStuff)
xVar = xVar + TheStuff(i)
Next i
End Property


and I tested the array with the following procedu

Sub TestTheObject()
Dim MyObject As TheObject
Set MyObject = New TheObject
Dim ArrVar(1 To 10) As Integer
Dim i As Integer
For i = 1 To 10
ArrVar(i) = 10 * i
Next i
MyObject.AddtheStuff = ArrVar
MsgBox MyObject.xVar
End Sub

I always end up with the same compilation error: can't assign an
array. Am I doing something wrong?

Thanks in advance for your help
Charles

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
combining cells and array from different sheets into an array to pass to IRR() [email protected] Excel Discussion (Misc queries) 3 September 11th 06 07:17 AM
Pass an array to Rank Biff Excel Worksheet Functions 12 June 29th 05 04:15 PM
How do I pass an array to a listbox? Titus A Ducksass - AKA broken-record Excel Programming 4 March 23rd 05 07:20 PM
How can I pass an array as TextToDisplay to a hyperlink? Jay Fincannon Excel Programming 4 January 28th 05 01:45 AM
Pass a variable from a class module pk Excel Programming 1 October 2nd 03 08:24 PM


All times are GMT +1. The time now is 07:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"