Custom Commandbar

  • Thread starter Stefano Condotta
  • Start date
S

Stefano Condotta

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
 
J

Jim Rech

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
| 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
|
|
 
S

Stefano Condotta

Thank you very much Jim. I should be able to manipulate that code to
suit my needs.

Regards,

Stefano Condotta
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top