How does one write optional parameters in functions and sub.?
Use the OPTIONAL keyword in the argument list, for example.... Code: 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.
Private Sub SomeSubRoutine(ByVal Par1 As String, Optional Par2 As Long = 0, Optional ByVal Par3 As Boolean = False)
Forum Rules