Assigns Keyword

Used to indicate that a value will be passed via a parameter to a method via the Assignment operator.

Assigns parameter As DataType

PartTypeDescription
parameter The name of the parameter being declared.
DataType Any valid data type The data type of the parameter.


Notes

Use the Assigns keyword when you want to assign a value to a parameter of a method with the equals sign rather than as an argument.

The Assigns keyword can appear in a Method declaration dialog box for the only parameter passed to the method or, if more than one parameter is being passed, for the last parameter. When Assigns is used, you use a different syntax when calling the method. The value for the parameter must be passed using the assignment operator rather than as an argument.


Example

The following declaration uses Assigns for the last parameter:

Sub theVolume(a as Integer, b as Integer, Assigns c as Integer)

When this method is called, only the values for a and b are passed as arguments; the value for c is passed using the assignment operator. For example:

theVolume(5,4)=10

If you try to use the syntax:

theVolume(5,4,10)

you will receive a Syntax error.


See Also

Assigns can only be used on the last parameter Error.