Alright guys I'm going to rephrase my problem again because I figured out something and this time I'm not going to cross post it (sorry about that). Basically, I'm trying to create an AddIn which will have a toolbar that will have a button that will run my macro. This is the code I'm using in the "ThisWorkBook" section of the Addin for creating the toolbar:
Private Sub Workbook_Open()
Call AddNewToolBar
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call DeleteToolbar
End Sub
Function AddNewToolBar()
Dim ComBar As CommandBar, ComBarContrl As CommandBarControl
On Error Resume Next
CommandBars("CountBinsToolbar").Delete
Set ComBar = CommandBars.Add(Name:="CountBinsToolbar")
ComBar.Visible = True
Set ComBarContrl = ComBar.Controls.Add(Type:=msoControlButton)
With ComBarContrl
.OnAction = "countBins"
End With
End Function
Function DeleteToolbar()
On Error Resume Next
CommandBars("CountBinsToolbar").Delete
End Function
Basically, the toolbar just won't appear. I'm not sure why, does anyone know?
Bookmarks