Problem assinging FaceID to toolbar

W

wschanks

I have this code, that fails when assinging the first faceID. If I
comment it out it works fine. The other faceID assign without a
problem.

With Application.CommandBars("Worksheet Menu
Bar").Controls("Tools").Controls.Add(Type:=msoControlPopup)
.Caption = conTopMenu
.FaceId = 23
.BeginGroup = True

With .Controls.Add(Type:=msoControlPopup)
.Caption = "Formulas" 'Submenu

With .Controls.Add
.OnAction = ThisWorkbook.FullName & "!" & conUnqCountSub
.FaceId = conUnqCountFaceID
.Caption = conUnqCountCaption
End With

With .Controls.Add
.OnAction = ThisWorkbook.FullName & "!" & conSPSub
.FaceId = conSPFaceID
.Caption = conSPCaption
End With

End With 'End Submenu

With .Controls.Add(Type:=msoControlPopup)
.Caption = "Formatting" 'Submenu

With .Controls.Add
.OnAction = ThisWorkbook.FullName & "!" & conStdFmtSub
.Caption = conStdFmtCaption
End With

End With 'End Submenu

With .Controls.Add(Type:=msoControlPopup)
.Caption = "Cell Manipulation" 'Submenu

With .Controls.Add
.OnAction = ThisWorkbook.FullName & "!" & conClrAposSub
.Caption = conClrAposCaption
End With

With .Controls.Add
.OnAction = ThisWorkbook.FullName & "!" &
conResetLastCellSub
.Caption = conResetLastCellCaption
End With

End With 'End Submenu

With .Controls.Add
.BeginGroup = True
.OnAction = ThisWorkbook.FullName & "!" & conHelpSub
.FaceId = conHelpFaceId
.Caption = conHelpCaption
End With

With .Controls.Add
.OnAction = ThisWorkbook.FullName & "!" & conAboutSub
.FaceId = conAboutFaceId
.Caption = conAboutCaption
End With
End With
 
J

Jim Cone

w,

A msoControlPopup will not accept a face id.
Take a look at the normal Excel menus.
Menu items that contain sub menu items do not have icon.

Jim Cone
San Francisco, USA


<[email protected]>
wrote in message

I have this code, that fails when assinging the first faceID. If I
comment it out it works fine. The other faceID assign without a
problem.

With Application.CommandBars("Worksheet Menu
Bar").Controls("Tools").Controls.Add(Type:=msoControlPopup)
.Caption = conTopMenu
.FaceId = 23
.BeginGroup = True

With .Controls.Add(Type:=msoControlPopup)
.Caption = "Formulas" 'Submenu

With .Controls.Add
.OnAction = ThisWorkbook.FullName & "!" & conUnqCountSub
.FaceId = conUnqCountFaceID
.Caption = conUnqCountCaption
End With

With .Controls.Add
.OnAction = ThisWorkbook.FullName & "!" & conSPSub
.FaceId = conSPFaceID
.Caption = conSPCaption
End With

End With 'End Submenu

With .Controls.Add(Type:=msoControlPopup)
.Caption = "Formatting" 'Submenu

With .Controls.Add
.OnAction = ThisWorkbook.FullName & "!" & conStdFmtSub
.Caption = conStdFmtCaption
End With

End With 'End Submenu

With .Controls.Add(Type:=msoControlPopup)
.Caption = "Cell Manipulation" 'Submenu

With .Controls.Add
.OnAction = ThisWorkbook.FullName & "!" & conClrAposSub
.Caption = conClrAposCaption
End With

With .Controls.Add
.OnAction = ThisWorkbook.FullName & "!" &
conResetLastCellSub
.Caption = conResetLastCellCaption
End With

End With 'End Submenu

With .Controls.Add
.BeginGroup = True
.OnAction = ThisWorkbook.FullName & "!" & conHelpSub
.FaceId = conHelpFaceId
.Caption = conHelpCaption
End With

With .Controls.Add
.OnAction = ThisWorkbook.FullName & "!" & conAboutSub
.FaceId = conAboutFaceId
.Caption = conAboutCaption
End With
End With
 

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