Finance

Charts

Statistics

Macros

Search

Procedure Parameter List with Excel VBA

The procedure parameter list <arguments> has the following syntax:

[Optional] [ByVal | ByRef] [ParamArray] variableName[()] _
    [As Type][= defaultValue]
  • Optional — keyword indicating that the parameter is not required. When this element is used, all subsequent parameters in the <arguments> list must also be optional and must be described with the keyword Optional. All parameters described as Optional must have the type Variant. The keyword Optional cannot be used for any parameter if the keyword ParamArray is specified.
  • ByVal — keyword indicating that the parameter is passed by value.
  • ByRef — keyword indicating that the parameter is passed by reference. The ByRef description is used in VBA by default.
  • ParamArray — keyword that can only be used as the last element in the <arguments> list, indicating that the final parameter is an optional array of values of type Variant. The ParamArray keyword allows you to specify an arbitrary number of parameters. It cannot be used together with the keywords ByVal, ByRef, or Optional.
  • variableName — the name of the variable, which must follow the standard variable naming rules.
  • Type — the data type of the parameter value passed into the procedure. Valid types:
    Byte, Boolean, Integer, Long, Currency, Single, Double, Date, String (only variable-length strings), Object, Variant.
    If the Optional keyword is not used, a user-defined type or an object type may also be specified.
  • defaultValue — defines the value assigned to the parameter by default. Used only together with the Optional parameter. If the type is Object, the only default value allowed is Nothing.
0 0 votes
Évaluation de l'article
S’abonner
Notification pour
guest
0 Commentaires
Le plus ancien
Le plus récent Le plus populaire
Online comments
Show all comments
Facebook
Twitter
LinkedIn
WhatsApp
Email
Print
0
We’d love to hear your thoughts — please leave a commentx