98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Upgrading code from Excel 2003 to 2010
Upgrading code from Excel 2003 to 2010
Resolved · Urgent Priority · Version 2010
Robert has attended:
Excel VBA Advanced course
Upgrading code from Excel 2003 to 2010
I have some code from Excel 2003:
Set MenuObject = Application.CommandBars(1). _
Controls.Add(Type:=msoControlPopup, _
Temporary:=True)
MenuObject.Caption = Caption
which works on my machine but not on another person's machine. I think it is security but everything looks the same. I have Googled the problem and it seems that CommandBars work differently now ut this doesn't explain why my version works. Any ideas, please?
RE: Upgrading code from Excel 2003 to 2010
Hi Robert, thanks for your query. The reason your code doesn't work is that there are no command bars in Excel 2007 or 2010 anymore. The interface has been "ribbonised" and there is no longer a CommandBar object/collection in the object model.
Hope this helps,
Anthony
RE: Upgrading code from Excel 2003 to 2010
Thanks for your quick reply, Anthony. Much appreciated. Yes, 2010 relies on the Ribbon rather than the use of CommandBars but reading John Walkenbach's Power Programming with VBA for Excel 2010 it appears that for compatability the CommandBar object is supported in 2010 but it's use is very restricted, eg it can only be used to add items to the Add-Ins tab of the Ribbon. My situation is that my code will work on my machine as required but the code is just ignored on another machine. Very puzzling. I will continue to investigate. Cheers.
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Create a unique items table from a duplicating table1. Ensure that your list has column headings |