Excel – “Object Library invalid or contains references…” in Excel VBA with DatePicker

activexexcelregistryvba

I have been working on a Excel workbook with lots of VBA code for a while and now I have send this file to some colleagues for testing and it does NOT work in their computer.
We all work in the same company and have Windows XP SP2 with Office 2003.

The workbook has a form that opens when clicking over a shape and it contains some controls.
When they click over the shape for the form to show the following error appears:

"Object Library invalid or contains
references to object defintions that
could not be found"

In the form there is a DatePicker and I think there lies the problem. If I delete the datePicker from the form and send them the file again they do not get this error message.

I already tried deleting the mscomct2.exd file as mentioned in this two sites "Microsoft" and "lessanvaezi" but the error stil pops. I checked and the new .exd file was generated.

Some Additional info:

  1. I check their system and they do have the file mscomct2.ocx in the correct location(c:\Winxp\System32).
  2. If I open a empty Excel file, go to the VBA editor go to Tools->Reference, I do NOT see the option to register the "Microsoft Common Control-2 6.0 (SP6)" (mscomct2.ocx). Instead I see a "Microsoft Windows Common Controls Satellite-3 6.2)" (cmct3de.dll).
  3. I send my collegue the file with the datePicker, but without the reference to the "Microsoft Common Control-2 6.0 (SP6)". Before clicking the shape and opening the form I tried to reference the MSCOMCT2.ocx library dinamically with the following code. It referenced the "Microsoft Common Control-2 6.0 (SP6)" but the error still pops.

Sub RegisterCtl()

'MSComCt2.ocx
strGUID = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}"
ThisWorkbook.VBProject.References.AddFromGuid guid:=strGUID, Major:=1, Minor:=0

end Sub

  1. If I then go to the form in the VBE editor and rightClick on the
    toolbox and then go to the
    Additional controls to add the
    "Microsoft Date and TimePicker"
    control, I see that option listed
    Two times. Unfortunatelly regarless
    of wich one I cchose, the behaviour
    is the same: The datepicker symbol
    is added in the toolbox, but when I
    drag the control to the form, a
    msgBox pops saying that the control
    was not available.

Has anybody an idea what is wrong? What can I do to make it run in their computer?

I appreciate any help.

Edit:

The computer with this problem has been Upgraded so I wont be able to find the specific solution for my case. I'm choosing Archers solution as it has helped the most people (Most Upvotes).

Best Answer

I have the same problem too. http://support.microsoft.com/kb/957924/en-us delete all .exd files make my program work!

Go into a command prompt and type the following DOS commands:

Code:

CD \Documents and Settings

DEL /S /A:H /A:-H *.EXD