vbaoutlookoutlook-form

How to detect Weekends on Outlook Custom Form?


I am talking about Outlook custom Form and not VBA Userform.

I use olkdatecontrol tool as datepicker. Is there any way to detect weekends using this tool?

I tried the following.

Sub cmdbutTest_Click
    getdate = Item.UserProperties.Find("Start").Value
    
    If(getdate = vbSunday or vbSaturday)then
        MsgBox "Date may not start on the weekend"  
    End If

End Sub

Solution

  • This one worked for me. Got this from https://stackoverflow.com/a/33115260/10711853

    MsgBox Weekday(MyDate, vbMonday) > 5