Installing the Microsoft Date and Time Picker for VBA
Some versions of Windows don't include the very useful Date and Time Picker control. This blog explains how to install the mscomct2.ocx file to get it back!

Posted by Andrew Gould on 24 February 2015

You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

Installing the Date and Time Picker Control for VBA

If you've attended one of our Excel VBA training courses you might remember using the Date and Time Picker control when building a user form.

Date and time picker

An exciting shot of the Date and Time Picker in action. As its name suggests, it allows a user to pick a date and time value rather than having to type it in.


The Date and Time Picker is immensely useful when designing VBA user forms but, sadly, it isn't included with every version of Windows.  I discovered this recently when moving to a new machine with a 64bit edition of Windows 7 installed.  Fortunately, it is relatively simple to install the Date and Time Picker, as long as you don't mind getting your hands dirty with a couple of simple command line instructions.

Downloading the Files You'll Need

The Date and Time Picker is part of a library of tools with the catchy title of MSCOMCT2.OCX.  To start with, you'll need to download this file from the Microsoft support site.

Download file

Click this link on the page to start downloading the file.

When you've clicked the link to start downloading the file, choose to save it somewhere on your computer.

Save as

Click the Save as option so that you can choose where to save the file.

On the next dialog box choose a location on your computer and then click Save to download the file.

Extracting the Downloaded File

Once it's finished downloading you'll need to extract the file.  Start by double-clicking on the file that you've downloaded.

Double click cab

Double-click the .cab file to see what it contains.


Once inside the .cab file you can choose to extract the .ocx file by right-clicking on it and choosing Extract...

Extract ocx

Right-click the file called mscomct2.ocx and choose to extract it.


Choose which folder you want to extract the file to and click Extract.

Extract to folder

Select an existing folder, or create a new one, and then click Extract.


Copying the File to the Correct Folder

In order to make use of the file you've downloaded you'll need to place it in the correct folder for the edition of Windows that you're using.  Start by opening a Windows Explorer window and browsing to the Windows installation folder. On my machine this is C:\Windows

Copy to folder

The next folder you need to browse to depends on which edition of Windows you're using. If you're using a 32bit edition you'll need the System32 folder. If you're using a 64bit edition, like I am, you'll need SysWOW64.


Once you've navigated to the correct folder, simply move or copy the MSCOMCT2.OCX file into it. 

File copied to correct folder

The file now sits in the correct folder.


Registering the File

Before you can make use of the file you'll need to register it.  You can do this using the command line tool in Windows.  Go to the Start menu and in the search box type cmd.

Type cmd

Type cmd into the search box at the bottom of the Start menu.


Still in the Start menu, right-click on the cmd.exe item which appears and choose to run it as an adminstrator.

Run as admin

Right-click on the icon and choose Run as administrator.


At the command prompt make sure that the directory shown is the same as the one you copied the file into earlier.

Check directory

If I was running a 32bit edition of Windows 7 this would be pointing to the correct folder.


If you need to change the directory you can do so using a command similar to the one shown below. Of course, you'll need to use the directory relevant to your own Windows installation.

Change directory

Press Enter at the end of the line to change the directory.


Once you've changed the directory you can write one final command to register the file on your machine.

Register file

For reference, the command is regsvr32 mscomct2.ocx

If everything works normally you should see a message similar to the one shown below:




Using the Date and Time Picker

You should now find that you can use the Date and Time Picker control in your VBA forms.


In the design view of a VBA form, right-click on the Toolbox and choose Additional Controls...


On the dialog box which appears, check the box next to the entry for the Microsoft Date and Time Picker Control 6.0.

Choosing dtp

You'll find that you have access to several other controls from the mscomct2.ocx library as well.


This blog has 0 threads Add post