<

Select Case from Enum Builder

Select Case from Enum Builder

Select Case from Enum Builder creates a 'Select Case' statement from enumerated constants.

The simplest variant (all checkboxes false results, example enum is MailFormat) in


Select Case varMailFormat
Case mfHTML

Case mfPlainText

Case mfRTF

End Select

If we check 'Single Case' the result is


Select Case varMailFormat
Case mfHTML, mfPlainText, mfRTF

End Select

If we check 'Return values' the result is


Function MyFunction() As String
Select Case varMailFormat
Case mfPlainText
MyFunction = mfPlainText
Case mfHTML
MyFunction = mfHTML
Case mfRTF
MyFunction = mfRTF
End Select
End Function

'Compact' makes the code use less space:


Select Case varMailFormat
Case mfPlainText: MyFunction = "PlainText"
Case mfHTML: MyFunction = "HTML"
Case mfRTF: MyFunction = "RTF"
End Select

Finally, 'Add Case Else' determines if a 'Else' case is added. The textbox 'Case Else' contains what line of code will be added in this case.