ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Custom Commandbar (https://www.excelbanter.com/excel-programming/324438-custom-commandbar.html)

Stefano Condotta

Custom Commandbar
 
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



Jim Rech

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



Stefano Condotta

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

Regards,

Stefano Condotta



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 12:22 PM.

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