Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Art Art is offline
external usenet poster
 
Posts: 587
Default Passing collections to an object

I did have a little trouble following it, but got what I needed to work. For
what it's worth, I pasted my test code below, in case it's of any use.
Actually I think my only problem was not using "Set" where I needed it.

Thanks again for letting me know it was doable.

'---This is a regular module---
Sub main()
Dim x As New Class1
Dim y As New Class2
Dim z
Set z = CreateObject("scripting.dictionary")
x.Name = "Art"
x.Age = 54
y.C1 = x
y.add = x
Set z = y.Coll
End Sub
'---End of module---


'---This is class 1---
Dim mName As String
Dim mAge As Integer

Property Let Name(ByVal Value As String)
mName = Value
End Property
Property Get Name() As String
Name = mName
End Property

Property Let Age(ByVal Value As Integer)
mAge = Value
End Property
Property Get Age() As Integer
Age = mAge
End Property
'---End of class 1---


'---This is class 2---
Dim mC1 As Class1
Dim z

Property Let C1(ByRef Value As Class1)
Set mC1 = Value
End Property
Property Get C1() As Class1
Set C1 = mC1
End Property

Property Let add(ByRef Value As Class1)
z.add 1, Value
End Property

Property Get Coll()
Set Coll = z
End Property

Private Sub Class_Initialize()
Set z = CreateObject("Scripting.Dictionary")
End Sub
'---End of Class 2---





"merjet" wrote:

P.S. If it's not clear from Tushar Mehta's post, yes, you can pass an
array to and from a Class. "Dim" a Class member variable as type
Variant and pass an array to it via a Property Let procedure.

Hth,
Merjet



Reply
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
Passing a variant object to a C++ dll Martin[_29_] Excel Programming 1 November 24th 06 01:44 PM
Passing a .NET DataSet object to Excel to be used with VBA Teddy Sohnrey Excel Programming 0 August 17th 06 12:07 PM
Passing a Label object to another procedure derobin Excel Programming 1 August 16th 06 10:43 AM
passing an object mark Excel Programming 2 May 22nd 06 04:37 PM


All times are GMT +1. The time now is 04:11 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"