Inspection Details

IsMissingWithNonArgumentParameter


Summary
Identifies uses of 'IsMissing' involving a non-parameter argument.
Reasoning
'IsMissing' only returns True when an optional Variant parameter was not supplied as an argument. This inspection flags uses that attempt to use 'IsMissing' for other purposes, resulting in conditions that are always False.
The following code example(s) would trigger this inspection:

Public Sub DoSomething()
    Dim foo As Variant
    If IsMissing(foo) Then Exit Sub ' condition is always false
    ' ...
End Sub

The following code example(s) would not trigger this inspection:

Public Sub DoSomething(Optional ByVal foo As Variant = 0)
    If IsMissing(foo) Then Exit Sub
    ' ...
End Sub


Back to List