# Microsoft Office Application Help - Excel Help forum > Excel Programming / VBA / Macros >  >  Excel ActiveX ControlBox Cannot Insert Object error

## exceltim

Hi,

Every time I try to insert an ActiveX control (eg command button) from the control toolbox onto an Excel worksheet, I get the error "Cannot Insert Object".  I've spent two hours searching the internet for a solution and nothing seems to help.  I thought I may need to register an ocx file, but if so, I don't know what it's called.  I tried registering the fm20.dll file, but I still get the error after doing that.  Does anyone have any suggestions?  This problem also prevents me from running macros in existing workbooks that have ActiveX controls, returning "unexpected error (32811)".

Tim

----------


## royUK

What version of Excel are you using?

Is the sheet/workbook protected?

----------


## exceltim

Hi Roy,

The problem is occurring in Excel 97.  Neither the workbook nor the worksheet are protected - the problem even happens in new books.

I had it working in Excel 97 under Windows Vista for a few months with no problems, then once I upgraded the operating system to Windows 7 the problem started.  I also have Office 2007, but need the 97 version for backwards compatibility - where I work there are a variety of Office versions used.

Cheers,

Tim

----------


## Leith Ross

Hello exceltim,

Try clearing out all the files and folders in the user TEMP directory. When a control is created in VBA a folder for Excel and VBE are created (Excel 8.0 and VBE). These folders hold information about the control in files with EXD extensions. These files are used are the initial creation of the control to speed loading. Although the EXD format is the same, the file contents vary depending on the Excel version being run. Problem is, these files are not deleted when you close Excel. If a file exists that contains a old control matching a newer version then the error "Cannot Insert Object" error is thrown. You can safely delete these files and folders in the TEMP directory without harm. You may also want to check your VBA References for any missing libraries.

----------


## exceltim

Thanks very much Leith.

Actually, the problem seemed to fix itself somehow - when I turned my computer on today I was able to place activex controls on worksheets in new and existing workbooks with no problem.  Perhaps it had something to do with re-registering the fm20.dll, requiring the computer to be restarted?  The only problem now is that error message "unexpected error 32811" occurring in a particular workbook - the problem part of the code seemed to be the sheet reference.  That is, my code said Sheet1.Activate, but the code wouldn't work until I changed it to Worksheets("Sheet1").Activate.  Not sure why this is the case considering Sheet1 is the sheet code name and was working perfectly before, but at least I've been able to get it working a different way.

Tim

----------


## profzeta

See:

http://support.microsoft.com/kb/3025036

Microsoft "Fix it" worked for me!

----------

