Avatar of iganu
iganu asked on

Need a code for VBA to populate date combo boxes

I am working in VBA custom programming inside of another software (NOT MS Office). I need to create a date field and am not wanting to use the calendar control since there is a limitation to admin work involved with installing and registering ocx files. Either I need something by which I can create the calendar myself or I create the combo box which will load the values for date/month and year. Are there any other suggestions

Web ComponentsVB ScriptProgramming

Avatar of undefined
Last Comment
F. Dominicus

8/22/2022 - Mon
F. Dominicus

there are really many options for that you could e.g use the Calendar active x.

You can bind a datasource to a combo box if you are in Access.

You can simply implement you own calendar class.

Or you just can look around for other calendar controls see. e.g:



The Steve Lebans example as reference by Friedrich is great I use it in virtually all the systems I build. There are no ocx registrations to worry about, it uses the windows API and it's simple to control.
Steve Lebans gives many examples of usage. http://www.lebans.com/monthcalendar.htm

Hi, While the examples provided are good, these are access forms. As I mentioned I am working in a product which allows for basic customization in VBA, so require something in pure VBA userforms.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
F. Dominicus

well VBA is bound to some Windows Office package. So what office Package are you using?
VBA is not a standalone product. So please be more specific about what you are really looking for.


I am working on a product - iGrafx (www.iGrax.com). This product can be customized to add some new forms etc, so I am working within that domain. I have attached the screen shot of the extensions available

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
F. Dominicus

I disagree, the example uses Excel, so my answer was on the point. If you like the posted code well, so be it, but the given answer was technically correct.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.

I never mentioned that your answer is wrong. The difference is that your code uses Access Forms, while the excel example uses vanilla VBA forms which was my requirement in first place. Hope it clarifies. I am not able to copy an Access form into my application user form to replicate..
F. Dominicus

Well it uses VBA for Excel and that is what I wrote. There does not exist a VBA form itself it's always part of one office-package. And the code would work in Access the same way. However this VBA code is one of the really bad pieces of code around.....