View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Identifying commandbar names in non-English versions of Excel

If you add this macro to the workbook where you use Bob's code then you can select a
commandbar name and run it to get all the ID numbers from the items that are in the commandbar.

I think you can always use the commandbar names but you must use the Id's for the
items that are in the commandbar

Sub ListMenuInfo()
'Lists Top Menu Item IDs
' Routine influenced by J.Walkenbach
' Gary Brown
' 12/08/2000
'
'
www.kinneson.com
'
Dim objTopMenu As Object
Dim strIDs As String
On Error Resume Next
'list each menu item
For Each objTopMenu In CommandBars(ActiveCell.Value).Controls
strIDs = strIDs & Chr(13) & objTopMenu.Caption & _
" - ID: " & _
CommandBars(ActiveCell.Value).Controls(objTopMenu. Caption).ID
Next objTopMenu
MsgBox strIDs
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Bob Phillips" wrote in message ...
Daniel,

Not sure if this is much use to you, but this code prints all the commandbar
names

Dim cb As CommandBar

For Each cb In CommandBars
Debug.Print cb.Name
Next cb

You would need to figure which non-English name matches the English version,
and I assume it will work in non-English apps.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Daniel Klann" wrote in message
...
Hi everybody,

I use code that adds a button to the 'Cell' commandbar (this is the
commandbar that appears when you right click in a worksheet cell). I want
to ensure that my code will work in all versions of Excel from 97 to 2003
(this has been tested successfully) and in non-English versions of Excel.

Can anyone tell me if the commandbars names are different in non-English
versions? If they are then how would I get a reference to the Cell
commandbar in code? I can't use the Index property as it seems to be
different depending on which version one is using. Also, I thought about
using the FindControl method on one of the Cell commandbar's buttons and
then getting the Parent property. The problem with this is that each

button
on the Cell commandbar exists on other commandbars so I can't be sure I'm
getting the right one.

Thanks for any help,

Daniel Klann