ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel 2003 Command bars (https://www.excelbanter.com/excel-programming/383186-excel-2003-command-bars.html)

[email protected]

Excel 2003 Command bars
 
I have an add-in that uses:

Set MenuObject = Application.CommandBars(1). _
Controls.Add(Type:=msoControlPopup, _
Befo=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?


Chip Pearson

Excel 2003 Command bars
 
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)


wrote in message
oups.com...
I have an add-in that uses:

Set MenuObject = Application.CommandBars(1). _
Controls.Add(Type:=msoControlPopup, _
Befo=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?




[email protected]

Excel 2003 Command bars
 
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.


Jim Rech

Excel 2003 Command bars
 
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
wrote in message
oups.com...
| 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.
|



[email protected]

Excel 2003 Command bars
 
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.



All times are GMT +1. The time now is 12:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com