Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I get this error: Compile error Argument not optional when i try to return a collection like this: For i = 1 To assyNums.count For j = 1 To assyNums.Item(i).getBOM.count partnum = assyNums.Item(i).getBOM.Item(j) occur = numOccurances(partnum) numOccur.Add (occur) Next j ....... (BOMParts is an obj variable and is already initialized) Public Function getBOM() As Collection getBOM = BOMparts End Function I have tried the simple way where I make a temporary collection an assign it to what ".getBOM()" returns but same error. Any help -- McManCS ----------------------------------------------------------------------- McManCSU's Profile: http://www.excelforum.com/member.php...fo&userid=2437 View this thread: http://www.excelforum.com/showthread.php?threadid=39422 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
M,
It is difficult to understand what you are trying to do. Please show your variable declarations and describe what the code is supposed to do. Jim Cone San Francisco, USA "McManCSU" wrote in message ... I get this error: Compile error Argument not optional when i try to return a collection like this: For i = 1 To assyNums.count For j = 1 To assyNums.Item(i).getBOM.count partnum = assyNums.Item(i).getBOM.Item(j) occur = numOccurances(partnum) numOccur.Add (occur) Next j ....... (BOMParts is an obj variable and is already initialized) Public Function getBOM() As Collection getBOM = BOMparts End Function I have tried the simple way where I make a temporary collection and assign it to what ".getBOM()" returns but same error. Any help? -- McManCSU ------------------------------------------------------------------------ McManCSU's Profile: http://www.excelforum.com/member.php...o&userid=24379 View this thread: http://www.excelforum.com/showthread...hreadid=394222 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() All I am trying to do is step through a collection which I have in a object. So I want is to do a 'get function' to get the collection store it into a temp variable, and then do a "for each... " But fo some reason if gives that error and points to where I assign tempBO the collection. Code ------------------- Private Sub setupTFIDF() Dim partnum As String Dim occur As Integer Dim numOccur As New Collection Dim tempBOM As New Collection Dim assy As New Assembly Dim comp As New Component For Each assy In assyNums tempBOM = assy.getBOM() For Each comp In tempBOM partnum = comp.getAssy() occur = numOccurances(partnum) numOccur.Add (occur) Next comp 'Calc TFIDF by sending number of boards and occurance list assy.determineTFIDF numBoards, numOccur Next assy End Su ------------------- and using this "Assembly" object: Code ------------------- Private BOMparts As New Collection ....... ....... Public Function getBOM() As Collection getBOM = BOMparts End Functio ------------------- -- McManCS ----------------------------------------------------------------------- McManCSU's Profile: http://www.excelforum.com/member.php...fo&userid=2437 View this thread: http://www.excelforum.com/showthread.php?threadid=39422 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Ok, i narrowed it down: Dim x As New Collection Dim y As New Collection x = y it errors with that same error on 'x=y' why and how can i fix it -- McManCS ----------------------------------------------------------------------- McManCSU's Profile: http://www.excelforum.com/member.php...fo&userid=2437 View this thread: http://www.excelforum.com/showthread.php?threadid=39422 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
M,
You may want to review: Don't Use The New Keyword In A Dim Statement http://www.cpearson.com/excel/variables.htm The following doesn't throw an error, but how you would use it is a puzzle to me. '------------------- Dim x As New Collection Dim y As New Collection Set x = y 'Do stuff Set x = Nothing Set y = Nothing '------------------ Jim Cone San Francisco, USA "McManCSU" wrote in message ... Ok, i narrowed it down: Dim x As New Collection Dim y As New Collection x = y it errors with that same error on 'x=y' why and how can i fix it? -- McManCSU |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Collection Object Keys | Excel Programming | |||
returning pivottable object from a range object | Excel Programming | |||
Function unable to return Collection object | Excel Programming | |||
Collection Class problems | Excel Programming | |||
CombBox - Object of What Collection? | Excel Programming |