I am using the Microsoft Date and Time Picker Control 6.0. How do I set the default date to today when the form initializes? Alternatively, is there a better date picker to use since I've heard that there can be a portability issue with this one?
I am using the Microsoft Date and Time Picker Control 6.0. How do I set the default date to today when the form initializes? Alternatively, is there a better date picker to use since I've heard that there can be a portability issue with this one?
Hi jeetkapadia
I've done a fair amount of work in this area. I'd suggest a non ActiveX Calendar Control. Here are several Links to examples...if you need help adapting let me know.
https://www.excelforum.com/excel-pro...-workbook.html
https://www.excelforum.com/excel-pro...ternative.html
https://www.excelforum.com/excel-pro...userforms.html
https://www.excelforum.com/excel-pro...-calendar.html
John
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please mark your Thread as SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
Hi jaslake,
I tried to use a couple of automatic ones but I guess that just won't work well. Can you tell me what I need to do to adapt the one that you have posted? All I want to do is have a textbox on the form show today's date on form initialization, and when clicked on, the calendar pops up like the 'DateTest' you share.
Hi jeetkapadia
The attached has a Simple User Form with a Textbox that does this...
If you need help adapting you'll need to attach your File.All I want to do is have a textbox on the form show today's date on form initialization, and when clicked on, the calendar pops up like the 'DateTest' you share.
Hi jaslake,
I got it to work, but when does this sub activate?
As in, what is the 'enter' action? One problem I'm running into is that when a date is entered, and the calendar closes, the cursor still blinks in the date box. So if you want to reopen the calendar, you have to click elsewhere, then click on the calendar text box again for it to show up. Clicking there while the cursor already blinks does not work. Is there any way to work around it other than shifting focus when the calendar closes? I've got the file on here if you want to take a look. The date is on the form 'Structural'![]()
Please Login or Register to view this content.
Last edited by jeetkapadia; 08-01-2017 at 04:16 PM.
Hi jeetkapadia
Firstly, your Workbook didn't include the Class Module...it's been incorporated into the attached. In the Class Module I've modified this Line of Code to correspond to your Form Initialize Format...
Secondly, in the User Form Initialize Event I've added this Line of Code...you may or may not want that...![]()
Please Login or Register to view this content.
Thirdly, regarding this...it's dependent on the Tab Order or Set Focus Order you've set...![]()
Please Login or Register to view this content.
As I don't know what Tab order you prefer, to set the Tab Order, right click on the User Form (in VBA) and move the Objects Up or Down as you see fit.what is the 'enter' action
Let me know how I can help.
Hi jaslake,
Thanks for your help! I think I didn't explain myself very well. When I select a date on the calendar and the calendar closes, the cursor is on the date textbox. So if I want to open the calendar again I need to click outside and then click on the textbox again to open it. Is there some way to change that?
Hi jeetkapadia
Add the indicated Line of Code to Sub PlateDate_Enter...
![]()
Please Login or Register to view this content.
Hi jaslake,
Thank you for all your help! I love the date calendar you've made and will probably go through all the code to see how it works :D
Hi jeetkapadia
You're welcome...glad I could help. Thanks for the Rep.
Unfortunately I can't take credit for being my Code...found it through Google and adapted to my needs.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks