Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Classes containing Classes

I have the following set up:

'Class Person
Private myPrivate as PrivateInfo
.....

Private Sub Class_Initialize()
Set myPrivate = new PrivateInfo
...
End Sub
....
Property Get getPrivate() as PrivateInfo
getPrivate = myPrivate
End Property
....

'End Class Person

where PrivateInfo is a different class module.

Then I have a userform that has a sub called setInfo that takes a
PrivateInfo as a parameter. Is there a way that I can call something
similar to this:

Private joe as Person

PrivateInfoUserform.setInfo joe.getPrivate()

I have code similar to that above but it gives me an "Object variable
or With block variable not set (Error 91)" error. What am I doing
wrong?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Classes containing Classes


Adam,

Property Get getPrivate() as PrivateInfo
getPrivate = myPrivate
End Property


should be

Property Get getPrivate() as PrivateInfo
SET getPrivate = myPrivate
End Property


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



"Adam" wrote in message
ups.com...
I have the following set up:

'Class Person
Private myPrivate as PrivateInfo
....

Private Sub Class_Initialize()
Set myPrivate = new PrivateInfo
...
End Sub
...
Property Get getPrivate() as PrivateInfo
getPrivate = myPrivate
End Property
...

'End Class Person

where PrivateInfo is a different class module.

Then I have a userform that has a sub called setInfo that takes
a
PrivateInfo as a parameter. Is there a way that I can call
something
similar to this:

Private joe as Person

PrivateInfoUserform.setInfo joe.getPrivate()

I have code similar to that above but it gives me an "Object
variable
or With block variable not set (Error 91)" error. What am I
doing
wrong?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Classes containing Classes

Thank you very much that worked perfectly.

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
data classes Huidekoper Excel Discussion (Misc queries) 1 April 21st 06 04:22 PM
Counting Classes MillerK Excel Discussion (Misc queries) 0 March 10th 06 03:32 PM
Using Classes in .xla oli Excel Programming 2 June 3rd 05 11:37 AM
Working with VBA classes via WSH possible? Stefan Bialucha Excel Programming 2 September 21st 04 02:54 PM
Using classes defined in an add-in Lieven Mettepenningen[_2_] Excel Programming 1 January 8th 04 03:01 PM


All times are GMT +1. The time now is 03:21 AM.

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"