< Day Day Up > |
You learned in Chapter 3 that variables can have data types. Function procedures, too, can have data types to indicate the data that they return. Here's a function procedure that explicitly returns an integer value: Function Procedure22(intInput As Integer) As Integer ' Multiple the input by ten and return it Procedure22 = intInput * 10 End Function As you can see, declaring a return data type for a function procedure uses the same syntax as declaring a data type for a variable: the As keyword followed by the data type. You can use any of the VBA data types for a function procedure's return value. If you don't specify a data type for the function, the return value will be a variant. Just as with a variable, this means that the return value can be of any data type. |
< Day Day Up > |