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.