There are two ways I can think of:
Option 1:
You can declare optional parameters of any data type and provide a default value to be used if that parameter is omitted.
Code:
'Option 1
Function Read(i1 As Integer, Optional i2 As Integer = 9999, Optional i3 As Variant = 9999, Optional i4 As Variant = 9999)
If i2 = 9999 Then
MsgBox "Parameter i2 not passed"
End If
If i3 = 9999 Then
MsgBox "Parameter i3 not passed"
End If
If i4 = 9999 Then
MsgBox "parameter i4 not passed"
End If
End Function
Option 2:
If you change the datatype of the Optional variables to Variant then you can use the IsMissing function to determine if the parameter was passed. It will return false for any other datatype, even if that parameter is declared as optional and is in fact missing. It also won't work if you assign a default value to the Optional Variant variable.
Code:
'Option 2
Function Read(i1 As Integer, Optional i2 As Variant, Optional i3 As Variant, Optional i4 As Variant)
If IsMissing(i2) Then
MsgBox "Parameter i2 not passed"
End If
If IsMissing(i3) Then
MsgBox "Parameter i3 not passed"
End If
If IsMissing(i4) Then
MsgBox "parameter i4 not passed"
End If
End Function