fibonacci
12-17-2013, 12:40 PM
Hello Everyone,
Is there a way to apply icon to command BAR?
I found that part of code online:
Private Sub Workbook_Open()
' vbaexpress.com/kb/getarticle.php?kb_id=427#instr
' 3/22/2010
Dim cmbBar As CommandBar
Dim cmbControl As CommandBarControl
Set cmbBar = Application.CommandBars("Worksheet Menu Bar")
If cmbBar.Controls(cmbBar.Controls.count).Caption <> "" Then
Set cmbControl = cmbBar.Controls.Add(Type:=msoControlButton, Temporary:=True)
End If
Set cmbControl = cmbBar.Controls.Add(Type:=msoControlPopup, Temporary:=True) 'adds a menu item
With cmbControl
.Caption = "&VBA Setup" 'names the menu item
With .Controls.Add(Type:=msoControlButton) 'adds a dropdown button to the menu item
.Caption = "Add-Ins Install" 'adds a description to the menu item
.OnAction = "ToolsInitDLL.AddinsInstall" 'runs the specified macro
.FaceId = 220 'assigns an icon to the dropdown
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Add-Ins Un-Install"
.OnAction = "ToolsInitDLL.AddInsUninstall"
.FaceId = 220
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Apply Macro Shortcuts"
.OnAction = "ToolsInitDLL.ApplyShortCuts"
.FaceId = 220
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "VB Library References"
.OnAction = "ToolsInitDLL.ListObjLibReferences"
.FaceId = 220
End With
End With
End Sub
I modified it to my needs, I applied FaceIds of my choosing to all buttons I've created.
But I'm wondering if there is a way to apply icon to command Bar. Here is where I want my icon to be:
i.imgur.com/TXrKq3D.png
I've tried .FaceId but it seems that it doesn't work for command Bars. Any ideas?
Is there a way to apply icon to command BAR?
I found that part of code online:
Private Sub Workbook_Open()
' vbaexpress.com/kb/getarticle.php?kb_id=427#instr
' 3/22/2010
Dim cmbBar As CommandBar
Dim cmbControl As CommandBarControl
Set cmbBar = Application.CommandBars("Worksheet Menu Bar")
If cmbBar.Controls(cmbBar.Controls.count).Caption <> "" Then
Set cmbControl = cmbBar.Controls.Add(Type:=msoControlButton, Temporary:=True)
End If
Set cmbControl = cmbBar.Controls.Add(Type:=msoControlPopup, Temporary:=True) 'adds a menu item
With cmbControl
.Caption = "&VBA Setup" 'names the menu item
With .Controls.Add(Type:=msoControlButton) 'adds a dropdown button to the menu item
.Caption = "Add-Ins Install" 'adds a description to the menu item
.OnAction = "ToolsInitDLL.AddinsInstall" 'runs the specified macro
.FaceId = 220 'assigns an icon to the dropdown
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Add-Ins Un-Install"
.OnAction = "ToolsInitDLL.AddInsUninstall"
.FaceId = 220
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Apply Macro Shortcuts"
.OnAction = "ToolsInitDLL.ApplyShortCuts"
.FaceId = 220
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "VB Library References"
.OnAction = "ToolsInitDLL.ListObjLibReferences"
.FaceId = 220
End With
End With
End Sub
I modified it to my needs, I applied FaceIds of my choosing to all buttons I've created.
But I'm wondering if there is a way to apply icon to command Bar. Here is where I want my icon to be:
i.imgur.com/TXrKq3D.png
I've tried .FaceId but it seems that it doesn't work for command Bars. Any ideas?