ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select standard toolbar button option (https://www.excelbanter.com/excel-programming/385289-select-standard-toolbar-button-option.html)

Gary''s Student

Select standard toolbar button option
 
On the worksheet I can pull-down:
View Toolbars Customize
I can then right-click any of the standard toolbar buttons and select:
Image and Text

How can I do this with VBA?
--
Gary''s Student
gsnu200710

Tom Ogilvy

Select standard toolbar button option
 
Sure. Turn on the macro recorder while you do it manually or sample code.

.Style = msoButtonIconAndCaption

--
Regards,
Tom Ogilvy


"Gary''s Student" wrote:

On the worksheet I can pull-down:
View Toolbars Customize
I can then right-click any of the standard toolbar buttons and select:
Image and Text

How can I do this with VBA?
--
Gary''s Student
gsnu200710


Jim Thomlinson

Select standard toolbar button option
 
Code like this...

Sub test()
Dim cbr As CommandBar
Dim ctl As CommandBarControl

Set cbr = Application.CommandBars("Standard")
Set ctl = cbr.Controls("Open")
ctl.Style = msoButtonIconAndCaption
End Sub

or did you want the customize dialog
--
HTH...

Jim Thomlinson


"Gary''s Student" wrote:

On the worksheet I can pull-down:
View Toolbars Customize
I can then right-click any of the standard toolbar buttons and select:
Image and Text

How can I do this with VBA?
--
Gary''s Student
gsnu200710


Gary''s Student

Select standard toolbar button option
 
Thank you
--
Gary''s Student
gsnu200710


"Tom Ogilvy" wrote:

Sure. Turn on the macro recorder while you do it manually or sample code.

.Style = msoButtonIconAndCaption

--
Regards,
Tom Ogilvy


"Gary''s Student" wrote:

On the worksheet I can pull-down:
View Toolbars Customize
I can then right-click any of the standard toolbar buttons and select:
Image and Text

How can I do this with VBA?
--
Gary''s Student
gsnu200710


Gary''s Student

Select standard toolbar button option
 
Thank you.

I'll use it in this form. Don't need a dialog since I'll be doing it in
loops.

Thanks again.
--
Gary's Student
gsnu200710


"Jim Thomlinson" wrote:

Code like this...

Sub test()
Dim cbr As CommandBar
Dim ctl As CommandBarControl

Set cbr = Application.CommandBars("Standard")
Set ctl = cbr.Controls("Open")
ctl.Style = msoButtonIconAndCaption
End Sub

or did you want the customize dialog
--
HTH...

Jim Thomlinson


"Gary''s Student" wrote:

On the worksheet I can pull-down:
View Toolbars Customize
I can then right-click any of the standard toolbar buttons and select:
Image and Text

How can I do this with VBA?
--
Gary''s Student
gsnu200710


Jim Thomlinson

Select standard toolbar button option
 
Not that you need the loop code but...

Sub test()
Dim cbr As CommandBar
Dim ctl As CommandBarControl

Set cbr = Application.CommandBars("Standard")
For Each ctl In cbr.Controls
ctl.Style = msoButtonIconAndCaption
Next ctl
End Sub
--
HTH...

Jim Thomlinson


"Gary''s Student" wrote:

Thank you.

I'll use it in this form. Don't need a dialog since I'll be doing it in
loops.

Thanks again.
--
Gary's Student
gsnu200710


"Jim Thomlinson" wrote:

Code like this...

Sub test()
Dim cbr As CommandBar
Dim ctl As CommandBarControl

Set cbr = Application.CommandBars("Standard")
Set ctl = cbr.Controls("Open")
ctl.Style = msoButtonIconAndCaption
End Sub

or did you want the customize dialog
--
HTH...

Jim Thomlinson


"Gary''s Student" wrote:

On the worksheet I can pull-down:
View Toolbars Customize
I can then right-click any of the standard toolbar buttons and select:
Image and Text

How can I do this with VBA?
--
Gary''s Student
gsnu200710


Tom Ogilvy

Select standard toolbar button option
 
Jim/Student,
I doubt this code will be run, but just a heads up, the Standard commandbar
has 3 types of controls:

CommandBarPopup &Paste
CommandBarButton &Format Painter
CommandBarComboBox &Undo

as examples. The CommandBarCombobox has a style property, but it doesn't
support msobuttonIconandCaption. The CommandBarPopup doesn't have a style
property.

So this code will produce an error after changing some of the buttons.

--
Regards,
Tom Ogilvy


"Jim Thomlinson" wrote in message
...
Not that you need the loop code but...

Sub test()
Dim cbr As CommandBar
Dim ctl As CommandBarControl

Set cbr = Application.CommandBars("Standard")
For Each ctl In cbr.Controls
ctl.Style = msoButtonIconAndCaption
Next ctl
End Sub
--
HTH...

Jim Thomlinson


"Gary''s Student" wrote:

Thank you.

I'll use it in this form. Don't need a dialog since I'll be doing it in
loops.

Thanks again.
--
Gary's Student
gsnu200710


"Jim Thomlinson" wrote:

Code like this...

Sub test()
Dim cbr As CommandBar
Dim ctl As CommandBarControl

Set cbr = Application.CommandBars("Standard")
Set ctl = cbr.Controls("Open")
ctl.Style = msoButtonIconAndCaption
End Sub

or did you want the customize dialog
--
HTH...

Jim Thomlinson


"Gary''s Student" wrote:

On the worksheet I can pull-down:
View Toolbars Customize
I can then right-click any of the standard toolbar buttons and
select:
Image and Text

How can I do this with VBA?
--
Gary''s Student
gsnu200710




Jim Thomlinson

Select standard toolbar button option
 
Thanks Tom... One way...
Sub test()
Dim cbr As CommandBar
Dim ctl As CommandBarControl

Set cbr = Application.CommandBars("Standard")
For Each ctl In cbr.Controls
With ctl
If .Type = msoControlButton Then .Style = msoButtonIconAndCaption
End With
Next ctl
End Sub

Or you could just use on error resume next with the previous code...
--
HTH...

Jim Thomlinson


"Tom Ogilvy" wrote:

Jim/Student,
I doubt this code will be run, but just a heads up, the Standard commandbar
has 3 types of controls:

CommandBarPopup &Paste
CommandBarButton &Format Painter
CommandBarComboBox &Undo

as examples. The CommandBarCombobox has a style property, but it doesn't
support msobuttonIconandCaption. The CommandBarPopup doesn't have a style
property.

So this code will produce an error after changing some of the buttons.

--
Regards,
Tom Ogilvy


"Jim Thomlinson" wrote in message
...
Not that you need the loop code but...

Sub test()
Dim cbr As CommandBar
Dim ctl As CommandBarControl

Set cbr = Application.CommandBars("Standard")
For Each ctl In cbr.Controls
ctl.Style = msoButtonIconAndCaption
Next ctl
End Sub
--
HTH...

Jim Thomlinson


"Gary''s Student" wrote:

Thank you.

I'll use it in this form. Don't need a dialog since I'll be doing it in
loops.

Thanks again.
--
Gary's Student
gsnu200710


"Jim Thomlinson" wrote:

Code like this...

Sub test()
Dim cbr As CommandBar
Dim ctl As CommandBarControl

Set cbr = Application.CommandBars("Standard")
Set ctl = cbr.Controls("Open")
ctl.Style = msoButtonIconAndCaption
End Sub

or did you want the customize dialog
--
HTH...

Jim Thomlinson


"Gary''s Student" wrote:

On the worksheet I can pull-down:
View Toolbars Customize
I can then right-click any of the standard toolbar buttons and
select:
Image and Text

How can I do this with VBA?
--
Gary''s Student
gsnu200710






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

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