How can I use an optional array argument in a VBA procedure?

前端 未结 4 452
旧巷少年郎
旧巷少年郎 2020-12-18 23:11

I\'ve got a private procedure in a VBA script for MS Access:

Private Sub drawLineDiagram(chartSpace As Variant, title As String, caption As String, x_val() As

4条回答
  •  生来不讨喜
    2020-12-18 23:18

    Perhaps you want a Parameter Array:

    In the procedure declaration, define the parameter list in the normal way. All parameters except the last one must be required (not Optional (Visual Basic)).

    Precede the last parameter name with the keywords ByVal ParamArray. This parameter is automatically optional. Do not include the Optional keyword.

    -- How to: Overload a Procedure that Takes an Indefinite Number of Parameters (Visual Basic)

    Reference for VBA: Understanding parameter arrays

提交回复
热议问题