Dorothy
Aug 21st, 2002, 01:22 AM
How does one write optional parameters in functions and sub.?
FatDaz
Aug 21st, 2002, 03:29 AM
Use the OPTIONAL keyword in the argument list, for example....
Private Sub SomeSubRoutine(ByVal Par1 As String, Optional Par2 As Long = 0, Optional ByVal Par3 As Boolean = False)
As with VB6, that if you make 1 argument optional, then all arguments that follow must also be optional.
And one change from VB6, is that you must always specify the default value for the optional argument.