CommandBar Controls

G

Guest

I have built menus and toolbars for my excel apps so I am familiar with
creating and setting up controls and buttons for commandbars. Now I am trying
to assign a FaceId to an msoControlButton, however this is not working. I can
assign FaceId's to buttons that I create, but not to standard ones like 'Save
As'

When I manually customize a toolbar I can add a control such as 'Save As',
then change it to default style, then select from one of the pictures. When I
try to record this in a macro I do not get any code for the FaceId change.

Ideas?
 
J

Jim Rech

I don't know about recording a macro but I have no problem changing the face
id of a built-in control:

Commandbars("Standard").Controls("New").FaceId=123

Did I misunderstand the problem?
--
Jim Rech
Excel MVP

|I have built menus and toolbars for my excel apps so I am familiar with
| creating and setting up controls and buttons for commandbars. Now I am
trying
| to assign a FaceId to an msoControlButton, however this is not working. I
can
| assign FaceId's to buttons that I create, but not to standard ones like
'Save
| As'
|
| When I manually customize a toolbar I can add a control such as 'Save As',
| then change it to default style, then select from one of the pictures.
When I
| try to record this in a macro I do not get any code for the FaceId change.
|
| Ideas?
 
G

Guest

after typing the dot after controls("New") I did not see FaceId in the drop
down. I looked at other code I had, and I had used it there so I was confused
why. Just thought I was missing something.

thanks

Simon
 
D

Dick Kusleika

Simon

It depends on how you reference the control. This:

Application.CommandBars(1).Controls("New")

will not bring up the FaceId because it's referencing the CommandBarControls
collection. That collection can contain different types of controls some of
which do not have the FaceID property. However, if you know that the
control your referencing has a FaceID property, you can use it anyway (as
Jim pointed out).

Dim cb as CommandBarButton
Dim cc as CommandBarControl

cb.FaceID = 123
cc.FaceID = 123

Since cb only references one type of control (that uses FaceID), FaceID will
show up on the popup. On the other hand cc won't show FaceID because it
could be any type of control.
 

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