I would like to obtain this set of properties with 1 class + 2 chained-classes:
mytable.EntireRange
mytable.DataBodyRange
mytable.HorizontalHeaderRange
mytable.VerticalHeaderRange
mytable.col(strTitle).num
mytable.col(strTitle).firstDataCell
mytable.col(strTitle).lastDataCell
mytable.row(strTitle).num
mytable.row(strTitle).firstDataCell
mytable.row(strTitle).lastDataCell
What's the best way to organize (and name) these classes and properties?
My current solution to add the chained properties is:
- I named the three classes "mytable", "mytable_col", "mytable_row" to keep a visible relationship in the Project Explorer
- inside "mytable", I added this:
Property Get col(strTitle As String) As mytable_col
Set col = New mytable_col
col.Initialize = Me ' passes the parent object
End Property
Property Get row(strTitle As String) As mytable_row
Set row = New mytable_row
row.Initialize = Me ' passes the parent object
End Property
Now... given that the three properties ("num", "firstDataCell", "lastDataCell") of the two parallel chained classes "col" and "row" share the same logic with little variations, I'd prefer to not put their complete code separated in 6 properties, three in the "row" class and three in the "col".
I ideally would to create just 3 properties/functions (passing a "row" or "col" as argument for the variations) instead than six.
How should I do? Is it possible, without to put them in an additional module?