Date Picker issue - Monday - first weekday

231 Views Asked by At

In the USA, the first day of the week is Sunday, but in many European countries the first day is considered Monday (see the attached captures). I was able to make it show the calendar accordingly, but there is an issue regarding the colors.

Sunday - first day of the week

enter image description here

Monday - first day of the week

enter image description here

The days of the month changed accordingly, but the colors of each CommandButton remain the same (see the light-yellow colored area). The portion of code which controls these colors is found in

Sub Build_Calendar()

If Format(DateAdd("d", (i - Weekday((CB_Mth.Value) & "/1/" & (CB_Yr.Value)), vbMonday), _
        ((CB_Mth.Value) & "/1/" & (CB_Yr.Value))), "mmmm") = ((CB_Mth.Value)) Then
            If Controls("D" & (i)).BackColor <> &H80000016 Then Controls("D" & (i)).BackColor = &H80000018  '&H80000010
            Controls("D" & (i)).Font.Bold = True
        If Format(DateAdd("d", (i - Weekday((CB_Mth.Value) & "/1/" & (CB_Yr.Value)), vbMonday), _
            ((CB_Mth.Value) & "/1/" & (CB_Yr.Value))), "m/d/yy") = Format(ThisDay, "m/d/yy") Then Controls("D" & (i)).SetFocus
        Else
            If Controls("D" & (i)).BackColor <> &H80000016 Then Controls("D" & (i)).BackColor = &H8000000F
            Controls("D" & (i)).Font.Bold = False
        End If

Does it know anyone in which way should I modify this code in order to have proper colors of the CommandButtons?

Thank you,

Dan

0

There are 0 best solutions below