How to Add Date Picker To VBA UserForm
I am looking for a control to add to userForm to enable a user to pick the date. I found a good one at this address
Formatting MM/DD/YYYY dates in textbox in VBA
from Siddharth Rout which is perfect but it generates invisible sheets which is not necessary for my application. I tried to stop creating sheets but I couldn't figure it out.
Can you please let me know how I can properly modify the Siddharth Rout code or point me to another application like that?
Thanks for your time
Solution 1:
OFFICE 2013 INSTRUCTIONS:
(For Windows 7 (x64) | MS Office 32-Bit)
Option 1 | Check if ability already exists | 2 minutes
- Open VB Editor
- Tools -> Additional Controls
- Select "Microsoft Monthview Control 6.0 (SP6)" (if applicable)
- Use 'DatePicker' control for VBA Userform
Option 2 | The "Monthview" Control doesn't currently exist | 5 minutes
- Close Excel
- Download MSCOMCT2.cab (it's a cabinet file which extracts into two useful files)
- Extract Both Files | the .inf file and the .ocx file
- Install | right-click the .inf file | hit "Install"
- Move .ocx file | Move from "C:\Windows\system32" to "C:\Windows\sysWOW64"
- Run CMD | Start Menu -> Search -> "CMD.exe" | right-click the icon | Select "Run as administrator"
- Register Active-X File | Type "regsvr32 c:\windows\sysWOW64\MSCOMCT2.ocx"
- Open Excel | Open VB Editor
- Activate Control | Tools->References | Select "Microsoft Windows Common Controls 2-6.0 (SP6)"
- Userform Controls | Select any userform in VB project | Tools->Additional Controls
- Select "Microsoft Monthview Control 6.0 (SP6)"
- Use 'DatePicker' control for VBA UserForm
Okay, either of these two steps should work for you if you have Office 2013 (32-Bit) on Windows 7 (x64). Some of the steps may be different if you have a different combo of Windows 7 & Office 2013.
The "Monthview" control will be your fully fleshed out 'DatePicker'. It comes equipped with its own properties and image. It works very well. Good luck.
Site: "bonCodigo" from above (this is an updated extension of his work)
Site: "AMM" from above (this is just an exension of his addition)
Site: Various Microsoft Support webpages
Solution 2:
You could try the "Microsoft Date and Time Picker Control". To use it, in the Toolbox, you right-click and choose "Additional Controls...". Then you check "Microsoft Date and Time Picker Control 6.0" and OK. You will have a new control in the Toolbox to do what you need.
I just found some printscreen of this on : http://www.logicwurks.com/CodeExamplePages/EDatePickerControl.html Forget the procedures, just check the printscreens.