Corrupted ActiveX control? "Can't exit design mode because Control 'DTPicker1" can not be created"

BillD picture BillD · May 17, 2014 · Viewed 26.5k times · Source

I am developing an Excel VBA application on my desktop machine. I have a DatePicker ActiveX control on my spreadsheet. It was working fine.

Then, while on travel, I was working on the application on a laptop. When I returned, I moved the file back to my desktop machine. Now when I try to run the app, I continually get the error "Can't exit design mode because Control 'DTPicker1" can not be created".

Renaming the control and all its references in the code hasn't helped. When I try to delete the control I still get the message even though there is no longer a control of that name.

How do I fix this?

Answer

Jean-François Corbett picture Jean-François Corbett · May 18, 2014

Sounds like something in your workbook got corrupted. Something like this has happened to me once or twice.

The solution is then to copy everything (code and sheet contents) to a new workbook and rebuild your application there.

[Upgraded from comment since this solved the issue.]