A procedure with a ParamArray argument cannot be called with named arguments

All arguments in a call to a procedure defined with a ParamArray must be positional. This error has the following cause and solution:

  • Named-argument syntax appears in a procedure call.

    The named-argument calling syntax can't be used to call a procedure that includes a ParamArray parameter. To supply only some elements of the ParamArray, use commas as placeholders for those elements you want to omit. For example, in the following call, if the ParamArray arguments begin after Arg2, values are being passed only for the first, third, and sixth values in the ParamArray:

    MySub Arg1, Arg2, 7,, 44,,,3 
    

    Note The ParamArray always represents the last items in the argument list.

For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.