I am trying to pass a collection to a VBA function but I'm getting a compile error I cannot seem to fix.
This is a simplified example that gives the error.
Sub test()
Dim fooString As String
Dim fooCollection As collection
Set fooCollection = New collection
useString (fooString)
useCollection (fooCollection)
End Sub
Public Function useString(foo As String)
MsgBox ("here")
End Function
Public Function useCollection(foo As collection)
MsgBox ("here")
End Function
I'm not seeing what I'm doing differently than what is shown in examples such as the one shown here: How do I sort a collection?
This is the error I'm getting (Compile Error: Argument not optional):