View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_5_] Bob Phillips[_5_] is offline
external usenet poster
 
Posts: 620
Default control button numbers (ID=???)

Updated to be more generic, more permanent

Sub test()
Dim ocb As CommandBar
Dim ctl As CommandBarControl
Dim i As Long, j As Long

i = 1
j = 1
ActiveSheet.Cells.ClearContents
For Each ocb In Application.CommandBars
Cells(i, j).Value = ocb.Name
Cells(i, j).Font.Bold = True
i = i + 1
For Each ctl In ocb.Controls
Cells(i, j) = CStr(ctl.ID) & " - " & ctl.Caption
i = i + 1
Next ctl
j = j + 1
i = 1
Next ocb
ActiveSheet.Columns.AutoFit
End Sub

writes the data to a worksheet

--
HTH

-------

Bob Phillips
... looking out across Poole Harbour to the Purbecks


"brym" wrote in message
...
Is this what you're looking for:

Sub test()
Dim ctl
For Each ctl In CommandBars("Standard").Controls
Debug.Print ctl.Caption, CStr(ctl.Id)
Next ctl
End Sub

"mcpheat" skrev i en meddelelse
...
Hi there
Can someone point me to a list of ALL ID numbers for control buttons
indicating what they are so I can create a custom list. I am wanting to
either
"delete" or "hide" the worksheet menu bar (or modify it on open) and

then
"restore" it back to it's former self on closure of the spreadsheet.
I am using xl97.

Thanks to whoever can help me!