Well, here it is, but it's going to take a learning curve to figure out
my problem.
But maybe not; like I said, I'm new to Excel/VBA, and maybe it just
looks weird to me.
The main line creates oMACdefn objects of class clsMACdefn5A.
Each oMACdefn contains oFUNCTdefn objects of class clsFUNCTdefn5A.
I want to access the main line's wsWorksheet object from a method (for
now), but I first have a problem coding the Property method. Then the
main line doesn't seem to pass me a good wsWorksheet, tho it looks okay
in the debugger.
Hope it's not too difficult to get thru this stuff,
and maybe even to figure it out!
Thanks,
Peter.
main line :
Dim oMACdefn As clsMACdefn5A
Dim oFUNCTdefn As clsFUNCTdefn5A
Public wsWorksheet As Worksheet
BTW, the main line contains both oMACdefn and oFUNCTdefn's because it's
reading a page that contains the data for both.
clsMACdefn5A:
Private aAllFUNCTRows(1 To maxNumberFUNCTs) As clsFUNCTdefn5A
PROBLEM ONE -- How to code the Property that sets the oMACdefn object
into clsFUNCTdefn5A.
===========
Main line :
Set oFUNCTdefn = New clsFUNCTdefn5A
oFUNCTdefn.doParent oMACdefn 'Compile error,
'Invalid use of Property
' (see below)
oFUNCTdefn.setParent oMACdefn ' ok
' debugger shows obj
clsFUNCTdefn5A
Private oParent As clsMACdefn5A
Public Property Let doParent(ByRef inn As clsMACdefn5A)
Set oParent = inn
End Property
--OR--
Public Property Set doParent(ByRef inn As clsMACdefn5A)
Set oParent = inn
End Property
WORK AROUND:
============
clsMACdefn5A:
oFUNCTdefn.setParent oMACdefn
clsFUNCTdefn5A
Private oParent As clsMACdefn5A
Public Sub setParent(ByRef inn As clsMACdefn5A)
Set oParent = inn
End Sub
PROBLEM TWO -- why doesn't clsMACdefn5A.getWorksheet() work when called
from clsFUNCTdefn5A?
===========
clsMACdefn5A:
Public wsWorksheet As Worksheet
Set wsWorksheet = ActiveSheet ' Class_Initialize
Public Function getWorksheet() As Worksheet
Set getWorksheet = wsWorksheet
End Function
clsFUNCTdefn5A:
Private wsWorksheet As Worksheet
wsWorksheet = oParent.getWorksheet ' runtime error
' obj doesn't support funct/prop.
' this happens when it's getting back to
clsFUNCTdefn5A
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!