I get an error:
invalid procedure call or argument: 'AddRange'
when passing a variable to ArrayList.AddRange(), but the code works fine when I pass the return value of a function instead, i.e.
My list:
Dim Foo
Set Foo = CreateObject("System.Collections.ArrayList")
Adding a new list returned by GetList()
works fine:
Call Foo.AddRange(GetList()) ' works fine
Function GetList()
Set GetList = CreateObject("System.Collections.ArrayList")
End Function
but passing a new list with a variable (x
) raises an error:
Dim x
Set x = CreateObject("System.Collections.ArrayList")
Call Foo.AddRange(x) ' error: invalid procedure call or argument: 'AddRange'
What is going on?