I'm not sure how to ask this question, so pardon my clumsiness. I have the following code (thanks to Andrewk32 for helping me put it together):
I would like to apply different FaceIds to each of my buttons. I don't want them to be consecutive (as the current setting indicates). I'd like the first button to have FaceId 107, the second to have 162, and the third to have 421. Is this possible within the current code layout? Thanks in advance for your help!
Code:
Private Sub Workbook_AddinInstall()
Dim iCtr As Long
Dim MacNames As Variant
Dim CapNamess As Variant
Dim TipText As Variant
Dim Toolbarname As String
Toolbarname = "Custom Toolbar"
MacNames = Array("TableFrame.TableFrame", _
"TablePopulator.TablePopulator", _
"BoxPlotCreator.BoxPlotCreator ")
CapNamess = Array("Create Table Outline", _
"Populate Table", _
"Create Box Plot")
TipText = Array("Creates a table pre-formatted to work with the Box Plot Utility. Do NOT disturb the formatting beyond adding additional columns or errors will likely occur!", _
"Calculates statistics and produces data necessary to create a box-and-whisker chart. Make sure that the cell with the fiscal year label is selected before issuing this command!", _
"Creates a box-and-whisker chart. Make sure that the top-left cell of the title bar is selected before issuing this command!")
With Application.CommandBars.Add(Toolbarname)
.Left = 200
.Top = 200
.Protection = msoBarNoProtection
.Visible = True
.Position = msoBarFloating
For iCtr = LBound(MacNames) To UBound(MacNames)
With .Controls.Add(Type:=msoControlButton)
.OnAction = "'" & ThisWorkbook.Name & "'!" & MacNames(iCtr)
.Caption = CapNamess(iCtr)
.Style = msoButtonIconAndCaption
.FaceId = 107 + iCtr
.TooltipText = TipText(iCtr)
End With
Next iCtr
End With
End Sub
Private Sub Workbook_AddinUninstall()
Dim Toolbarname As String
Toolbarname = "Custom Toolbar"
On Error Resume Next
Application.CommandBars(Toolbarname).Delete
End Sub
I would like to apply different FaceIds to each of my buttons. I don't want them to be consecutive (as the current setting indicates). I'd like the first button to have FaceId 107, the second to have 162, and the third to have 421. Is this possible within the current code layout? Thanks in advance for your help!