ISMISSING(argname)

Returns the value True or False depending if the optional argument has been passed to a procedure (Boolean).


argnameThe argument name (String).

REMARKS
* A procedure refers to either a subroutine or a function.
* This function is only used in conjunction with Optional Arguments.
* This function only works for variables declared as Variant.
* This cannot be used with simple data types like Boolean, Integer, Double, Date, etc. Simple data types are always automatically initialised to their zero equivalent values.
* A variable declared as Variant that is missing actually contains the error 448 (Warning Argument not found) and for this reason the ISERROR function will do exactly the same as this function.
* If "argname" is left blank then, True is returned.
* If this function is used on a ParamArray argument then it will always return False.
* To test if an ParamArray is empty compare the upper ad lower bounds.
* In VB.NET, this function has been removed because default values are now required for all optional arguments.
* In VB.NET this function has been replaced with an IsNothing function which can be used to test if a default value is Nothing.
* For the Microsoft documentation refer to docs.microsoft.com

Private Sub MyProcedure(Optional ByVal bFlag As Boolean) 
'does not work, the default for a Boolean data type is always False
   If IsMissing(bFlag) Then
   End If
End Sub

Private Sub MyProcedure(Optional ByVal dtDate As Date)
'does not work, the default for a Date data type is always "0:0:0"
   If IsMissing(dtDate) Then
   End If
End Sub

Private Sub MyProcedure(Optional ByVal vVariant As Variant)
   If IsMissing(vVariant) Then
   End If
End Sub

© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited Top