Declaring Arguments

If your function or subroutine needs to receive input values from the code that calls it, you must declare an argument for each value. The following statements declare a subroutine that accepts two arguments:

Sub DisplayMsg (astrMsg1 As String, astrMsg2 As String)
End Sub

As you can see, each argument declaration begins with a name, then the word As, then the name of the data type you expect to receive. Many programmers prefix all argument names with the letter a (as shown in the previous example), but this is entirely at your discretion. You can name the arguments after the inhabitants of your fish tank, if you like.

Arguments are positional. The first argument you declare in a function or subroutine receives the first value ...

Get Faster Smarter Beginning Programming 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.