ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   control button numbers (ID=???) (https://www.excelbanter.com/excel-programming/272739-re-control-button-numbers-id%3D.html)

Bob Phillips[_5_]

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!










All times are GMT +1. The time now is 04:53 PM.

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