I don't know why one would really like to do things like this, but...
VB Code:
Option Explicit Private Enum LETTERS [UC A to Z] = 0 [LC a to z] = 1 End Enum Private Function Uniq(CaseType As LETTERS) As String Select Case CaseType Case [UC A to Z] Uniq = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" Case [LC a to z] Uniq = "abcdefghijklmnopqrstuvwxyz" End Select End Function Private Sub Form_Load() Debug.Print Uniq([UC A to Z]) End Sub
Spooky.
Edit!
And if someone wants to complain about performance, then just make it an array:
VB Code:
Option Explicit Private Enum LETTERS [UC A to Z] = 0 [LC a to z] = 1 End Enum Private Uniq(1) As String Private Sub InitUniq() Uniq([UC A to Z]) = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" Uniq([LC a to z]) = "abcdefghijklmnopqrstuvwxyz" End Sub Private Sub Form_Load() InitUniq Debug.Print Uniq([UC A to Z]) End Sub
And it works a lot faster.




Reply With Quote