Download, install and use mscomct2.ocx
- John
- 9 hours ago
- 6 min read
.ocx files are "OLE Control Extension" files ... they're similar to .dll ("Dynamic Link Library") files but contain the visual elements of ActiveX Controls.
mscomct2.ocx contains the "Date and Time Picker" (DTPicker) and MonthView ActiveX Controls (and a few others ... see below).
There are two key things to note about mscomct2.ocx:
The Controls it contains do not work at all with 64-bit Office but do work with 32-bit Office (just for clarity: the bitness of Windows doesn't matter ... it is the bitness of Office that does). If you are not sure which bitness of Office you have, open any Office application then select: File > Account > About (Word / Excel / Access etc) and the title of the dialog will include the bitness after the application name, version and build number.
It hasn't been part of the default Office installation for some considerable time ... I can't say since when exactly ... but given that it is 32-bit only, I'm guessing it was around Office 2010 given that 2010 was the first version of Office that came in both 32-bit and 64-bit versions whereas Office 2007 was 32-bit only (also, you'll see later that the mscomct2.ocx file was last updated on or just before 24th March 2009).
Also just for clarity that mscomct2.ocx is distinct from comctl32.ocx and mscomctl.ocx which are still maintained by Microsoft and do have both 32-bit and 64-bit compatibility (you can download them from the Microsoft Visual Basic 6.0 Common Controls web page).
So which Controls are contained in which file:
mscomct2.ocx contains: Animation, Date and Time Picker (DTPicker), FlatScrollBar, MonthView and UpDown (see image below)
comctl32.ocx and mscomctl.ocx contain: ImageComboBox, ImageList, ListView, ProgressBar, Slider, StatusBar, TabStrip, Toolbar and TreeView

A last point to note before doing this on your device is that this won't work in Access ... you can download and install mscomct2.ocx and the Controls will be available in all VBA-hosting applications with the exception of Access ... because the 'Additional Controls' menu item in the Toolbox is missing in Access. And before someone comments that Access doesn't support UserForms ... not true! You can:
Add UserForms from within Access but you must customise the main menu's "Insert" menu first (credit to Colin Riddington for this!):
View > Toolbars > Customize
Then select the Commands tab and click on Rearrange Commands
Ensure "Menu Bar" is selected then select "Insert" in the drop-down then click on Add
Under Categories select Insert then under Commands select UserForm then OK then Close and Close again
Now you can add a UserForm via Insert > UserForm
Import UserForms created in the VBE in other applications into Access using the "Import File" menu item (in "File" in the main menu or in the Project window context menu)
Downloading mscomct2.ocx
So the reason I wrote this post is that I recently needed to work on a project that included a Date and Time Picker ... it was many, many years since I had seen any code that used any of the mscomct2.ocx Controls. None of my still-working devices had a copy of mscomct2.ocx on them so the first challenge I had was getting hold of a copy of mscomct2.ocx (without using some dodgy website). This is how I got it ... seems simple when you know how, but this took me some time to figure out.
First, go to the Microsoft Visual Basic 6.0 Service Pack 6 Cumulative Update page ... it's an official Microsoft web page ... and download the VB60SP6-KB2708437-x86-ENU.MSI file to your device. This file is an installer for the VB6 service pack noted in the name of the web page and it contains a copy of the mscomct2.ocx file.
To be security conscious, right-click on the downloaded file and select Properties then Digital Signatures and you will see the file is digitally signed by Microsoft Corporation ... in other words, I'm not trying to trick you into downloading a dodgy file!
Next, extract the files from the MSI file. How I learnt how to do this is here https://superuser.com/a/307679 (so please give the answerer an upvote if you can). But to be more specific for the file we are working with, do this: open an administrator-level command prompt window (you actually don't need it to be administrator-level for this step but you will for the step that follows). Then type in this command ...
... adjusting the path if the file is on a different drive or in a different folder (and, obviously, replacing "UserName" with your own user name). This will create a "VB60" folder ... open it and, within that, open the SYSTEM folder in which you will find a whole load of files ... including mscomct2.ocx (there's a lot of similarly-named files, make sure you use the right one!).
Again, be security conscious and right click on the mscomct2.ocx file and select Properties then Digital Signatures and you will see the file is digitally signed by Microsoft Corporation. And this is where you'll see the file was last signed on 24th March 2009 (and so was last updated on, or just before, that date).
If you don't fancy using the msiexec command, the same 'superuser' question has other answers suggesting that 7Zip and other tools can be used ... I haven't tried them ... you are welcome to do so!
Installing mscomct2.ocx
To install, you need to know whether you are using 32-bit Windows or 64-bit Windows (note: Windows, not Office ... as I said above, mscomct2.ocx only works in 32-bit Office!). If you don't know the bitness of Windows for your device, go to Settings > System > About and under Device Info (or Device Specifications) look for System Type.
If Windows is 32-bit, copy mscomct2.ocx to the "C:\Windows\System32\" folder. Then go back to your command prompt window and enter:
If Windows is 64-bit, copy mscomct2.ocx to the "C:\Windows\SysWOW64\" folder. Then go back to your command prompt window and enter:
You should get a message that "DllRegisterServer ... succeeded".
If you get an error:
Check you are using an elevated (administrator-level) command prompt window (it should include "Administrator" in the title bar if you are)
Check you have identified the right bitness of Windows and you are using the right folder (and so the right version of regsvr32.exe ... the versions in System32 and SysWOW64 are not the same!)
You can see mscomct2.ocx in the folder
Group policy and / or a locked-down registry on the device can also cause problems ... if you are working in an environment where your IT is controlled centrally (e.g. a corporate IT environment) then you may need to speak to your IT team
Using mscomct2.ocx
Once installed, you should have immediate access to the relevant Controls i.e. you shouldn't need to close and re-start whichever host application you are using ... but if you don't see the Controls then that would be the first thing to do.
In case you don't know how to add the Controls to a UserForm:
1. Add / open a UserForm
2. Show the Toolbox if it is not already showing (in the VBE menu: View > Toolbox)
3. Right-click on a blank space in the Toolbox and select Additional Controls
4. Scroll down through the list looking for the relevant Control ... their names all begin with "Microsoft" and end with "Control 6.0 (SP6)" so you are looking for, for example, "Microsoft Date and Time Picker Control 6.0 (SP6)" and "Microsoft MonthView Control 6.0 (SP6)" etc ... put a check (or cross) in the box next to whichever you want to use in your UserForm.
5. Click OK
6. You will now see icons for the Control(s) in the Toolbox ... hover your mouse over them to see which icon is which if you added multiple of them ... in the image of the Toolbox, below, the last 5 icons are for the 5 Controls from mscomct2.ocx: Animation, Date and Time Picker (DTPicker), FlatScrollBar, MonthView, UpDown (the other icons are always present: the "Select Objects" arrow and then the set of 14 standard MSForms Controls)
7. As you would for any other Control, click and drag them onto your UserForm UI.
8. Adding the icons for the Controls to the Toolbox is "sticky" (but only per-application) ... having added them once you will find they are always visible. If you want to hide them again, just right click on the icon and select the Delete option.

After that, the Controls work similarly to all other Controls ... you can set their properties in the Properties window, call methods and use events.
The documentation for each of the Controls is here:
Animation: https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-basic-6/aa276375(v=vs.60)
Date and Time Picker (DTPicker): https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-basic-6/aa276346(v=vs.60)
FlatScrollBar: https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-basic-6/aa276347(v=vs.60)
MonthView: https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-basic-6/aa276348(v=vs.60)
UpDown: https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-basic-6/aa276376(v=vs.60)
Unfortunately, the links for "See Also", "Example", "Properties", "Methods" and "Events" on each of those pages stopped working long ago. You can, though, dig around and find the relevant documentation using the links on the left of the web pages (each of the above links will have taken you to the docs for the specific Control within the Objects menu item ... if you collapse the Objects menu item then you will see various other menu items for Properties, Methods etc ... expand them to find the docs for the member that you are interested in).
For example, here is the documentation for the MaxDate and MinDate properties of the DTPicker and MonthView: https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-basic-6/aa276398(v=vs.60)
And just remember that if you distribute a VBA Project that uses these Controls to another device then that device must be using 32-bit Office and must have mscomct2.ocx installed.


Comments