JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,687
- Office Version
- 365
- Platform
- Windows
The following code snippet works. The optional parameter p3 can be "ON", "OFF", or omitted (missing).
But I would like to move the IsMissing test inside the Case statement. This code gets an error, but is something like it possible?
Code:
Public Function Temp(p1, p2, Optional p3 As Variant) As Variant
. . .
If Not IsMissing(p3) Then
Select Case UCase(pErrMsgSw)
Case "ON": ErrMsgSw = True
Case "OFF": ErrMsgSw = False
Case Else
. . . some error handling . . .
End Select
End If
But I would like to move the IsMissing test inside the Case statement. This code gets an error, but is something like it possible?
Code:
Public Function Temp(p1, p2, Optional p3 As Variant) As Variant
. . .
Select Case UCase(pErrMsgSw)
Case Is Missing
Case "ON": ErrMsgSw = True
Case "OFF": ErrMsgSw = False
Case Else
. . . some error handling . . .
End Select
End If