Passing Arguments

A procedure can be defined to accept as many arguments as required. Each argument represents a piece of data that is passed to the procedure when it is called. Argument syntax is identical for sub- and function procedures. The argumentlist has the following basic syntax:

						argname1 As type, argname2 As type, ...

Each argname is a unique name that follows VBA's standard naming rules. Type specifies the data type of the argument. An argument can be any of VBA's built-in data types, an object type, a user-defined type, or an enumeration. If the As type clause is omitted, the argument will default to type Variant. Within the procedure, each argument is available as a regular variable. An example of a function that takes one type ...

Get Office® XP Development with VBA now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.