1

I was just trying to write a function like this:

Public Function myGetAttribute(ByVal xmlFileName As String, _
                                   ByVal ParamArray elementV() As String, _
                                   ByVal ParamArray attributesV() As String) As Collection

This is not working

"End of parameter list expected. Cannot define parameters after a paramarray parameter."

Why is it not possible to put two paramarrays as parameters and what is a workaround?

ruedi
  • 5,365
  • 15
  • 52
  • 88
  • Because it's impossible to determine where the first array ends and starts the second – Veikedo May 08 '14 at 09:43
  • I see only one `ParamArray` in the signature you posted. – svick May 08 '14 at 09:45
  • but the arrays have different names shouldnt it be possible to deterine where the first array ends and the second starts? svick: sorry, I edited the post. – ruedi May 08 '14 at 09:50

1 Answers1

1

There can be only one ParramArray and it has to be the last. It looks like you want pass two arrays as parameters to your sub and not an an unknown number of parameters.

Public Function myGetAttribute(ByVal xmlFileName As String, _
                                   ByVal elementV() As String, _
                                   ByVal attributesV() As String) As Collection

More here: MSDN

David Sdot
  • 2,343
  • 1
  • 20
  • 26