View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Rech Jim Rech is offline
external usenet poster
 
Posts: 2,718
Default Custom Commandbar

I assume you want to add control buttons for each visible window in Excel
like the Window menu has.

If you run this code you see the Excel has 10 window placeholders on the
Window toolbar, of type 830, in reserve:

Sub a()
Dim ctrl As CommandBarControl
For Each ctrl In CommandBars("worksheet menu bar") _
.Controls("Window").Controls
Debug.Print ctrl.Caption & " " & ctrl.Visible & " " & ctrl.ID
Next
End Sub

But how they get assigned to particular windows seems to be handled in Excel
and hidden from us because this code doesn't result in anythin real useful:

Sub aa()
With CommandBars("worksheet menu bar") _
.Controls("Tools").Controls _
.Add(msoControlButton, 830)
.Caption = "Book2"
End With
End Sub

Fun to play with though.

--
Jim Rech
Excel MVP
"Stefano Condotta" wrote in message
news:C_oVd.557862$8l.499479@pd7tw1no...
| Hi
|
| I have created a custom command bar, through code, with a "Window" menu
and
| controls similar to the "Worksheet Menu Bar" but I cannot get the open and
| selected workbooks to show up at the bottom of the custom menu. Is there
any
| special code or ID to get this to show or is that functionality only
within
| the built in worksheet menu bar?
|
| Regards,
|
| Stefano
|
|