Excel 2003 Command bars

  • Thread starter Thread starter charlieguthrie
  • Start date Start date
C

charlieguthrie

I have an add-in that uses:

Set MenuObject = Application.CommandBars(1). _
Controls.Add(Type:=msoControlPopup, _
Before:=PositionOrMacro, _
Temporary:=True)
MenuObject.Caption = Caption

to create a new menu item. It works fine on 98% of our supposedly
identical machines but on the other 2% it will not run. I've seen
"Detect and Repair" occasionally fix the problem but not on all
machines. Anyone know what's going on and how to fix it?
 
What happens when it "will not run"? Error messages? Nothing happening?
Details count.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)
 
The error message I get is:

Run-Time Error '-2147467259 (80004005)' Method 'Add' of object
'CommandBarControls' failed.

You can either End the macro or go to Debug mode.

Is there anything else I can provide to help in diagnosing the issue.
As a reminder, the exact same code is in production on roughly 100
machines with no issues.
 
If, for any reason, the worksheet menu bar is protected you will get this
error. You might add this code just before yours:

Application.CommandBars(1).Protection = msoBarNoProtection

Of course there may be some other reason for the problem.

--
Jim
| The error message I get is:
|
| Run-Time Error '-2147467259 (80004005)' Method 'Add' of object
| 'CommandBarControls' failed.
|
| You can either End the macro or go to Debug mode.
|
| Is there anything else I can provide to help in diagnosing the issue.
| As a reminder, the exact same code is in production on roughly 100
| machines with no issues.
|
 
Problem solved. The user had a corrupted profile, i.e. the folder c:
\documents and settings\<user id>\Application Data did not exist.
Logging on an as admin, renaming the user's old profile and having the
user log on (which causes a new profile to be created) solved the
problem.
 
Back
Top