Parameters are variables that hold arguments passed to the procedure when the procedure is called by a procedure call statement from a procedure or a test. Parameters can be declared as Val or Var, that is, a parameter's argument may be passed by value or by reference. An argument is a variable that is passed to a procedure.
You can define a parameter in the Variables Properties window:
Click in the Variables View of the Procedures View to add a variable to the procedure.
Right-click and select Insert Object After from the context menu.
Click on the new variable. Right-click and select Properties from the context menu to display the Variables Properties window. For more information, see Variables Properties Window.
Click the Parameter pull-down menu in the Variables Properties window.
Select one of the following parameters:
Val — The parameter is a local variable which is set to the value of the passed argument when the procedure is called.
Since the Val parameter is a local variable, any changes made to that parameter in the procedure do not affect the original argument value. The passed argument expression must be such that parameter = argument is a legal assignment statement.
Select the Optional checkbox to make this parameter optional. Optional indicates that the argument may be omitted when the procedure is called.
Var — The parameter is a reference to the passed argument.
References to the parameter in the procedure are references to the passed argument. Therefore any changes made to that parameter in the procedure affect the original argument value.
The general rule is that the type of the passed argument must match the type of the parameter. The exceptions are :
An argument of any type can be passed to a Any or Variant parameter.
An argument of any enumerated type can be passed to a Long parameter.
For a list of compatible data types for Val or Var parameters, see Compatible Argument Types.
For parameters, which are arrays, you can only specify the number of dimensions in an array, such as a one or two-dimensional array, not the size of each dimension.
For a Var parameter that is an array, the argument must be an array of a data type compatible with the specified number of dimensions.