ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Custom toolbar with existing formatting buttons (https://www.excelbanter.com/excel-programming/335352-custom-toolbar-existing-formatting-buttons.html)

TonyRizzo

Custom toolbar with existing formatting buttons
 
Is there any way to install or create a custom toolbar with existing
formatting commandbar controls from an addin? I'd like to use those nice
AlignLefts, AlignRights, etc, right alongside the custom buttons of the
addin, along with their nearly unlimited undos and redos. Anyone got a
clue? I sure don't.

Tony Rizzo



Jim Cone

Custom toolbar with existing formatting buttons
 
Tony,

Each menu item or toolbar button has a unique identification number.
So if you know the ID number, a copy of that control can be added
to another command bar.
For example, the following snippet adds the "Sort" menu item (from the
Data menu) to a custom command bar called "Sort Options..."
'-------
With cmdNewControl
.Caption = "&Sort Options..."
.OnAction = ThisWorkbook.Name & "!DoMenuCheck"
Set cmdItem = .Controls.Add(ID:=928)
'-------

The following lists the button ID's for the two default toolbars...

Standard Toolbar...
&New 2520
Open 23
&Save 3
&Mail Recipient 3738
Print 2521
Print Pre&view 109
&Spelling 2
Cu&t 21
&Copy 19
&Paste 22
&Format Painter 108
&Undo 128
&Redo 129
Hyperl&ink 1576
&AutoSum 226
Paste Function 385
Sort &Ascending 210
Sort Des&cending 211
&Chart Wizard 436
&Drawing 204
&Zoom: 1733
Microsoft Excel &Help 984


Formatting Toolbar...
&Font: 1728
&Font Size: 1731
&Bold 113
&Italic 114
&Underline 115
&Align Left 120
&Center 122
&Align Right 121
&Merge and Center 402
&Text Direction 4027
Sheet Right to left 1925
&Currency Style 395
&Percent Style 396
&Comma Style 397
&Increase Decimal 398
&Decrease Decimal 399
&Decrease Indent 3162
&Increase Indent 3161
&Borders 203
&Fill Color 1691
&Font Color 401

'-------

Jim Cone
San Francisco, USA



"TonyRizzo" wrote in message
...
Is there any way to install or create a custom toolbar with existing
formatting commandbar controls from an addin? I'd like to use those nice
AlignLefts, AlignRights, etc, right alongside the custom buttons of the
addin, along with their nearly unlimited undos and redos. Anyone got a
clue? I sure don't.

Tony Rizzo




All times are GMT +1. The time now is 07:16 PM.

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