Is Optional Argument Missing Method
The Is Optional Argument Missing method determines if an optional argument for a procedure is missing. It returns one of the following values:
-1 (negative one). An optional argument is missing.
0 (zero). An optional argument is not missing.
Format
IsMissing(argname)
The following table describes the arguments that you can use with this method.
Argument | Description |
---|---|
argname |
An optional argument for a subroutine, function, Siebel VB statement, or Siebel VB method. |
Example
The following example prints a list of uppercase characters. The user determines the quantity printed. If the user must print every character, then this example calls the myfunc function without any argument. The function uses the Is Optional Argument Missing method to determine to print every uppercase character or to print only the quantity that the user specifies:
Function myfunc(Optional arg1)
If IsMissing(arg1) = -1 then
arg1 = 26
End If
msgtext = "The letters are: " & Chr$(10)
For x = 1 to arg1
msgtext = msgtext & Chr$(x + 64) & Chr$(10)
Next x
End Function
Sub Button_Click
Dim arg1
arg1 = 0
If arg1 = 0 then
myfunc()
Else
myfunc(arg1)
End If
End Sub