View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jeremy Jeremy is offline
external usenet poster
 
Posts: 14
Default Help with paramarray

I have a class with a method that essentially creates a new object of
the same type with the same contents. Since I may want to omit one or
more of the source instance's contents, I have a paramarray argument in
there, and basically, if one of the items exists in the passed array,
it gets skipped and not copied.

Now, I've gone from specifying the excluded items as a list in the
arguments to creating an array of excluded items. I figured that this
would work the same way, but for some reason, the method is getting an
array where the first element is also an array (which is the element I
want).

Here is my crappy code:

Public Function Replicate( _
ParamArray Exclude() As Variant) As Factors

Dim fct As New Factors
Dim lngIndex As Integer
Dim varNames As Variant
Dim varFactors As Variant
Dim varIgnore As Variant

varNames = pDict.Keys
varFactors = pDict.Items
varIgnore = Exclude
For lngIndex = 0 To pDict.Count - 1

If Not IsElementOf(CStr(varNames(lngIndex)), varIgnore) Then

fct.Add CStr(varNames(lngIndex)), CCur(varFactors(lngIndex))

End If

Next lngIndex

Set Replicate = fct

End Function

Any idea what I'm doing wrong?