How do I test if optional arguments are supplied or not?

前端 未结 8 427
后悔当初
后悔当初 2020-12-05 09:20

How do I test if optional arguments are supplied or not? -- in VB6 / VBA

Function func (Optional ByRef arg As Variant = Nothing)

    If arg Is Nothing Then          


        
8条回答
  •  孤城傲影
    2020-12-05 09:57

    You can use the IsMissing() Function. But this one only works with the Variant datatype.

    Sub func(Optional s As Variant)
       If IsMissing(s) Then
          ' ...
       End If
    End Sub
    

提交回复
热议问题