Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Calc Macros: Multiple Optional Parameters


i want to use a Sub with multiple optional paramters in LibreOffice Calc like this:

Sub test(_
ByRef mandatory As String, _
Optional ByRef optional1 As String, _
Optional ByRef optional2 As String)

If IsMissing(optional1) Then
    msgbox "Optional Argument 1 Is missing"
    msgbox "Optional Argument 1 is: " & optional1
End If

End Sub

Now i want to call this Sub while not using the first optional paramter "optional1"


To my suprise IsMissing(optional) does not detect that "optional1" is missing. Instead the macro acts like "optional1" is existing and gives me the message box telling me "Optional Argument 1 is: Error |".

How do i handle subs with multiple optional paramters?