Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Let property changing all values in Class module
I have a three tiered Class modules Set up:
clsEVM contains a collection of clsMonths which contains a collection of clsWBSIDs In the clsEVM and clsMonths classes, I use the following to set the underlying classes: 'Set the entire WBSID collection Property Set WBSIDs(S As Collection) Set pWBSID = S End Property 'Get the entire WBSID collection Property Get WBSIDs() As Collection Set WBSIDs = pWBSID End Property 'Get a specific WBSID entry Public Function WBSID(index As Variant) As clsWBSID 'If numeric, decalre based off index If IsNumeric(index) Then If index pWBSID.Count Or index < 1 Then Err.Raise 9 Else Set WBSID = pWBSID(index) End If Else Dim WP As clsWBSID 'If string, find appropriate value in collection For Each WP In pWBSID If UCase(WP.ChargeCode) = UCase(index) Then Set WBSID = WP Exit For End If Next End If End Function My problem is that when I use the line: Me.Month(iMonth).WBSID(sWBSID).ACWP = 5 in the clsEVM module, no matter what imonth is, all instances of sWBSID found in any particular iMonth are made equal to 5, instead of just the 1 instance in iMonth. So if I have 3 months, and iMonth is = 1, sWBSID for iMonth = 1, iMonth = 2, and iMonth = 3 will become 5 and I just want iMonth = 1 to equal 5. I can set an object to represent the individual Month in the class to avoid the confusion, but I thought that was a bit redundant. Thanks for any help on this. (I searched the MSDN and Chip's site to no avail) -- ********************* J Streger MS Office Master 2000 ed. MS Project White Belt 2003 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Let property changing all values in Class module
Just a guess but have you tried:
Me.Month.Item(iMonth).WBSID(sWBSID).ACWP = 5 (assuming it's a collection) You don't show any code related to the "Month" property - that would help. Tim "J Streger" wrote in message ... I have a three tiered Class modules Set up: clsEVM contains a collection of clsMonths which contains a collection of clsWBSIDs In the clsEVM and clsMonths classes, I use the following to set the underlying classes: 'Set the entire WBSID collection Property Set WBSIDs(S As Collection) Set pWBSID = S End Property 'Get the entire WBSID collection Property Get WBSIDs() As Collection Set WBSIDs = pWBSID End Property 'Get a specific WBSID entry Public Function WBSID(index As Variant) As clsWBSID 'If numeric, decalre based off index If IsNumeric(index) Then If index pWBSID.Count Or index < 1 Then Err.Raise 9 Else Set WBSID = pWBSID(index) End If Else Dim WP As clsWBSID 'If string, find appropriate value in collection For Each WP In pWBSID If UCase(WP.ChargeCode) = UCase(index) Then Set WBSID = WP Exit For End If Next End If End Function My problem is that when I use the line: Me.Month(iMonth).WBSID(sWBSID).ACWP = 5 in the clsEVM module, no matter what imonth is, all instances of sWBSID found in any particular iMonth are made equal to 5, instead of just the 1 instance in iMonth. So if I have 3 months, and iMonth is = 1, sWBSID for iMonth = 1, iMonth = 2, and iMonth = 3 will become 5 and I just want iMonth = 1 to equal 5. I can set an object to represent the individual Month in the class to avoid the confusion, but I thought that was a bit redundant. Thanks for any help on this. (I searched the MSDN and Chip's site to no avail) -- ********************* J Streger MS Office Master 2000 ed. MS Project White Belt 2003 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Let property changing all values in Class module
The code to declare months in the clsEVM is:
Property Set Months(S As Collection) Set pMonth = S End Property Property Get Months() As Collection Set Months = pMonth End Property Public Function Month(index As Integer) As clsMonth If index pMonth.Count Or index < 1 Then Err.Raise 9 Else Set Month = pMonth(index) End If End Function Months are only numbered so I don't need to index them by a string value. As you can see my evm.Month function should return single month, but somehow even though I return a single month, I affect all months equally. -- ********************* J Streger MS Office Master 2000 ed. MS Project White Belt 2003 "Tim" wrote: Just a guess but have you tried: Me.Month.Item(iMonth).WBSID(sWBSID).ACWP = 5 (assuming it's a collection) You don't show any code related to the "Month" property - that would help. Tim "J Streger" wrote in message ... I have a three tiered Class modules Set up: clsEVM contains a collection of clsMonths which contains a collection of clsWBSIDs In the clsEVM and clsMonths classes, I use the following to set the underlying classes: 'Set the entire WBSID collection Property Set WBSIDs(S As Collection) Set pWBSID = S End Property 'Get the entire WBSID collection Property Get WBSIDs() As Collection Set WBSIDs = pWBSID End Property 'Get a specific WBSID entry Public Function WBSID(index As Variant) As clsWBSID 'If numeric, decalre based off index If IsNumeric(index) Then If index pWBSID.Count Or index < 1 Then Err.Raise 9 Else Set WBSID = pWBSID(index) End If Else Dim WP As clsWBSID 'If string, find appropriate value in collection For Each WP In pWBSID If UCase(WP.ChargeCode) = UCase(index) Then Set WBSID = WP Exit For End If Next End If End Function My problem is that when I use the line: Me.Month(iMonth).WBSID(sWBSID).ACWP = 5 in the clsEVM module, no matter what imonth is, all instances of sWBSID found in any particular iMonth are made equal to 5, instead of just the 1 instance in iMonth. So if I have 3 months, and iMonth is = 1, sWBSID for iMonth = 1, iMonth = 2, and iMonth = 3 will become 5 and I just want iMonth = 1 to equal 5. I can set an object to represent the individual Month in the class to avoid the confusion, but I thought that was a bit redundant. Thanks for any help on this. (I searched the MSDN and Chip's site to no avail) -- ********************* J Streger MS Office Master 2000 ed. MS Project White Belt 2003 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
unable to set the values property of the series class | Excel Discussion (Misc queries) | |||
Unable to set the Values property of the Series class | Charts and Charting in Excel | |||
VBA error: Unable to set the Values property of the Series class | Charts and Charting in Excel | |||
Setting the Values Property of the Series Class | Excel Programming |