troubleshooting Question

Need help with a function

Avatar of Eileen Murphy
Eileen MurphyFlag for United States of America asked on
Visual Basic Classic
4 Comments1 Solution178 ViewsLast Modified:
How do I use this below function? DayValue(?? datdate) --- I used to pass a data in: DayValue(Date) -- and I thought it worked fine. Now it doesn't appear to work that way.

Any idea?

Public Function DayValue(ByVal datdate As Date)

Dim strDay As String
Dim strMonth As String
Dim strYear As String
Dim lngDay As Long

strYear = Format(datdate, "YYYY")
strMonth = Format(datdate, "MMMM")
lngDay = Format(datdate, "DD")

Select Case lngDay
Case 1
strDay = "First"
Case 2
strDay = "Second"
Case 3
strDay = "Third"
Case 4
strDay = "Fourth"
Case 5
strDay = "Fifth"
Case 6
strDay = "Sixth"
Case 7
strDay = "Seventh"
Case 8
strDay = "Eighth"
Case 9
strDay = "Ninth"
Case 10
strDay = "Tenth"
Case 11
strDay = "Eleventh"
Case 12
strDay = "Twelfth"
Case 13
strDay = "Thirteenth"
Case 14
strDay = "Fourteenth"
Case 15
strDay = "Fifteenth"
Case 16
strDay = "Sixteenth"
Case 17
strDay = "Seventeenth"
Case 18
strDay = "Eighteenth"
Case 19
strDay = "Ninteenth"
Case 20
strDay = "Twentieth"
Case 21
strDay = "Twenty-first"
Case 22
strDay = "Twenty-second"
Case 23
strDay = "Twenty-third"
Case 24
strDay = "Twenty-fourth"
Case 25
strDay = "Twenty-fifth"
Case 26
strDay = "Twenty-sixth"
Case 27
strDay = "Twenty-seventh"
Case 28
strDay = "Twenty-eighth"
Case 29
strDay = "Twenty-ninth"
Case 30
strDay = "Thirtieth"
Case 31
strDay = "Thirty-first"
End Select

DayValue = "the " & strDay & " day of " & strMonth
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros