In excel-vba, how do I pass a paramarray into a function which expects the same paramarray? I've been looking around but can't seem to find any answers to this specific problem
My code looks like this:
Sub test()
GetRefData "SPX Index", "PX_LAST", "PX_VOLUME", "PE_RATIO", "PX_TO_CASH_FLOW"
End Sub
Public Function GetRefData(security As String, ParamArray fields() As Variant) As String
Debug.Print fields(0) // returns "PX_LAST"
SendReq security, fields
End Function
Sub SendReq(security, ParamArray fields() As Variant)
Debug.Print fields(0) // returns type mismatch
End Sub
Debug.Print fields(0)when I am in SendReq, VBA returns a 'type mismatch' error