PDA

View Full Version : Calendar userform ( datepicker )



Rolly_Sefu
06-03-2019, 03:38 AM
Hello,

The company that i work in made some changes in windows, and i can't see the Calendar userform from Excel ( missing from pc: Microsoft MonthView Control 6.0 )


So i found a calendar that someone created, but i am having trouble adjusting it me my needs.

I managed to disable the selection for the weekend.
And to always have the selection on today.
Managed to load it from a userfrom, and send the date into another textbox.


The problem i have:
Today is 3'rd June, and i select a date from january.
Next time i load the userform i want the calendar to show June month (month from today), NOT JANUARY
But the wierd thing is if i don't select a date the second time ( i close the calendar )
The 3'rd time i open the userform it is back to the correct month.


Can anyone help me identify the code lines that i need to change ? (file is in the attachment)

Thank you.

dotchiejack
06-03-2019, 05:39 AM
Try this one.
calendar will pop up when you enter the 2th textbox.

yujin
06-03-2019, 07:20 PM
Hi, Rolly.

You should unload the DatePickerForm instead of hiding it.
Try to change "Me.Hide" to "Unload Me".

Rolly_Sefu
06-05-2019, 03:55 AM
Hello,

I have tested the DatapickerOnly V2.2 => it works just i as want
Just a small question: is it possible to restict the selection for saturday and sunday ?


I replaced the "Me.hide" with "Unload.Me" => works great, thank you

Thank you

大灰狼1976
06-05-2019, 06:01 PM
Hi Rolly_Sefu!
Modify the class module code as follow:

Public WithEvents v_label As MSForms.Label
Private Sub v_label_click()
Dim n&
n = Split(v_label.Name, "_")(1) Mod 7
If n = 0 Or n = 6 Then Exit Sub
UserForm1.TextBox2 = v_label.Tag
v_label.ForeColor = vbRed
End Sub

Rolly_Sefu
06-05-2019, 11:00 PM
That works perfectly.

Thank you.