This charmer was found in the codebase im working on now. I almost fell out of my chair when I first encountered it:
Public Function MyMonthName(ByVal m As Long, _ Optional ByVal appr As Boolean = False) As + String Dim tmp As String Select Case m Case 1: tmp = "January" Case 2: tmp = "February" Case 3: tmp = "March" Case 4: tmp = "April" Case 5: tmp = "May" Case 6: tmp = "June" Case 7: tmp = "July" Case 8: tmp = "August" Case 9: tmp = "September" Case 10: tmp = "October" Case 11: tmp = "November" Case 12: tmp = "December" Case Else: tmp = Format(m, "0") End Select If appr Then MyMonthName = Left(tmp, 3) Else MyMonthName = tmp End If End Function
First they ignore you, then they laugh at you, then they fight you, then you win.
-- Gandhi
In reply to Re: The joys of bad code
by demerphq
in thread The joys of bad code
by BUU
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |