Function Dates Times Class

WeekdayFmString

"Weekday Number From Name" or "Weekday Name To Number" Convert a string naming a day of the week into a numeric constant. Return the vb numeric value corresponding to the named day of the week.

Signature (Visual Basic / VBA)

Public Function WeekdayFmString( _
    ByVal vDayName As Variant _
    ) As Variant

Code Example

    WeekdayFmString("Saturday") = vbSaturday
    WeekdayFmString("Tuesday") = vbTuesday
    IsNull(WeekdayFmString("Otherday")) = True

Parameters

Parameter Description
vDayName String containing the name of one of the days of the week. Function returns Null if vDayName is Null or cannot be fixed up to a String. This function recognizes the following names: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday. The match is not case-sensitive so, for example, "monday" and "MONDAY" both match "Monday". Function returns Null if vDayName is not one of the valid weekday names.