Using Date picker in Visual Basic with a Userform

  • [xpost][/xpost]


    What im wanting to do is this (There are 6 Datepickers in the workbook)

    1. I want to be able to when i open a userform in excel i want to have the Date picker to default to the current date.

    2. I want know in the code that im about to post what code i should use to make this happen and where to put it in the macro. This code is in the initialize part of the workbook.

    3. Im going to attach the excel file also.

    4.The Date picker i have used is the one that is in the tool box in the visual basic.

    5. If you cant tell me how to do this with the toolbox please let me know how it can be done with my code that i have by adding more code or how ever.


    Thanks


  • Hello,


    The DatePicker is an additional control in the UserForm ToolBox ... (provided the DLL library is available on your computer)


    see explanation :

    External Content www.youtube.com
    Content embedded from external sources will not be displayed without your consent.
    Through the activation of external content, you agree that personal data may be transferred to third party platforms. We have provided more information on this in our privacy policy.


    Should you have difficulties, depending on your own system or configuration ...


    see https://www.ablebits.com/offic…xcel-datepicker-template/


    Hope this will help

    :)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner:)

  • DatePickers are not available on many systems. I would never use one in any project, especially if it is to be used by others. This would mean checking that the DatePicker is installed on every machine to use it.


    Take a look at my non-ActiveX alternatives.


    Alternative DatePickers

  • Guys my problem is how do i use these calanders in a userform? i dont know how to get them into the form and code it to where it will work.

    Sorry but i need some detail instruction.

    Attached is a very simple (quickly drafted) example : DatePicker in UserForm ... for your inspiration ;)


    Hope this will help

    :)

  • JHave you not bothered looking at my example.?


    frmTest shows how to use the CalendarForm from a differentUserForm This has been used 100s of times!

  • Hello Dennis,


    Attached is your test file


    Modifications were added for your TextBox13 ... you do need to replicate them for all your other 6 identical Text Boxes


    Hope this will help

    :)

  • Wow Carim thank you !

    Couple other thing that i was wondering about:

    1. when i click that text box and the calender pops up can it be set up to where it will default to the current date and show up in the textbox?

    2. can you explain the class modules to me and how they work? i did some research but didnt get much out of the research.


    Thanks

    Dennis

  • Carmin,


    I did test the userform and i want to say thanks for helping me.

    what i thought could possible happen when i opened the userform the date would show up in that textbox instead of haveing to click the textbox and the datepicker show up and me pick the date.

    if it does that i didnt see it doing that and not sure that can happen either.


    Thanks

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!