Reputation: 5623
I have a subroutine that looks like this. It has two parameters.
Sub Advance(ByRef listR() As String, rCount)
...code
End Sub
When I try to call this:
Advance listR:=theList, theCount
It gives me a compile error:
Expected: named parameter
Why is this? It works fine like...
Sub Advance(rCount)
...code
End Sub
And called via:
Advance theCount
Or also works with just the array parameter.
Upvotes: 1
Views: 3329
Reputation: 6703
From MSDN:
When you supply arguments by a mixture of position and name, the positional arguments must all come first. Once you supply an argument by name, the remaining arguments must all be by name.
Upvotes: 2
Reputation: 328598
I believe that you can call your sub any of the following ways, but you can't name the first parameter and not name the second one:
Advance listR:=theList, rCount:=theCount
Advance rCount:=theCount, listR:=theList
Advance theList, rCount:=theCount
Advance theList, theCount
Call Advance(listR:=theList, rCount:=theCount)
Call Advance(rCount:=theCount, listR:=theList)
Call Advance(theList, rCount:=theCount)
Call Advance(theList, theCount)
Upvotes: 3