Set ButtonIcon in Menu through Code

S

Sreedhar

Can anyone help ?

I've created a custom menu for my application. Sample code I've been using
is given below. My problem is to give the menu items a FaceID. I want to know
all the FaceIDs available with Access (Xp), so that I can choose which to use
where.

Any help is greatly appreciated.

MyMenu Code:
Sub CreateADBMenu()
On Error GoTo Err_CreateADBMenu

Dim myMenuBar As CommandBar
Dim myMenu As CommandBarPopup
Dim myMenuItem As CommandBarButton

On Error Resume Next
CommandBars("ADBMenu").DELETE
On Error GoTo 0

'<------------------------------------------------------------ADB Menu Bar
0.0.0

Set myMenuBar = CommandBars.Add("ADBMenu", msoBarTop, True)

'<-----------------------------------------------------------New Business
1.0.0

Set myMenu = myMenuBar.Controls.Add(msoControlPopup)
myMenu.Caption = "New Business"

'<------------------------------------------------------------Setup Branch
1.1.0

Set myMenuItem = myMenu.Controls.Add(msoControlButton)
With myMenuItem
.Caption = "SetUp Branch"
.Style = msoButtonIconAndCaption
.FaceId = 23
.OnAction = "SetUpBranch" 'create procedure to call
End With

'<---------------------------------further code to create other menu items

With myMenuBar
.Protection = msoBarNoMove
.Visible = True
End With

Exit_CreateADBMenu:
Exit Sub

Err_CreateADBMenu:
MsgBox err.DESCRIPTION
Resume Exit_CreateADBMenu

End Sub
 

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