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

4

7

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?

Blakely answered 17/5, 2014 at 19:6 Comment(2)
Sounds like something got corrupted. Try appspro.com/Utilities/CodeCleaner.htm else just copy everything to a new workbook and rebuild your application there.Brut
The CodeCleaner did not fix the problem. HOWEVER, copying sheets and exporting/importing code into a new workbook seems to have done the trick. Thanks for the suggestion.Blakely
M
6

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.]

Mort answered 18/5, 2014 at 20:8 Comment(0)
T
1

In my case, an error occurred when I developed an excel sheet with ActiveX DTPicker control in MS Excel 2013, moved it to Excel 2010 (still working), saved some changes and moved it back to the development environment in Excel 2013 - DTPickers cannot be loaded.

After some internet investigation I found a bit tricky manual how to solve the issue:

  1. Open the project code and unload the References that Excel allows.
  2. Make some little change in your code (I added one comment line) - to reload the project or something like that.
  3. Run some macro, for example only the one activating the first sheet.
  4. Close and reopen the Excel.
  5. Voila - Date and time pickers are loaded correctly.

As a firs I deleted the temporary files in "C:\Users\xxx\AppData\Local\Temp\Excel8.0" but it did not helped as a standalone action, so I don't know, if it is a useful action or not.

Till answered 25/2, 2015 at 17:1 Comment(0)
B
0

Had a similar issue where "Control 'CommandButton13' can not be created". The spreadsheet still worked on my colleagues PC. I spotted in the VBA editor that Sheet13 had become renamed to CommandButton1. On my colleagues PC, we changed the name back to Sheet13. It now works OK on my PC.

Buettner answered 21/9, 2015 at 11:58 Comment(0)
P
0

Years later, stumbled on a solution, only because I recorded the steps that led up to the situation.

1) Had changed all worksheet securities to include UserInterfaceOnly:= True 2) Active-X controls were on protected sheets

The Workbook:Open included a routine to refresh all the sheet protections, something needed for UserInterfaceOnly to work, allowing macros to make sheet changes, but not the user. Always the newest Active-X control gave the 'Can't Exit Design Mode because..." or if the project is protected altogether, a 57121 error, which is catastrophic if trying to switch the offered Debug mode. Saving the workbook with the sheet that has the newest AC on it and reopening gave no issue.

Solution: Copied the protection loop at bottom to the top of Workbook_Open and changed protect to unprotect password(whatever yours is). Now the workbooks open again without any of these 2 warnings. Added the protection loop also to the Before_Safe to ensure the workbook would always be in a secure state, in case it gets loaded on a macro disabled system.

Private answered 18/1, 2020 at 11:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.