J
JGPatrick
I've created a custom toolbar for Access 2007 with the following code:
Sub CreateToolbar()
On Error Resume Next
Application.CommandBars("PracticeCommandBar").Delete
On Error GoTo 0
Dim cbar As Office.CommandBar 'I have the needed reference to Office library
Dim cntrl As Office.CommandBarControl
Set cbar = Application.CommandBars.Add("PracticeCommandBar", msoBarTop, _
Temporary:=True)
Set cntrl = Application.CommandBars("PracticeCommandBar").Controls.Add( _
msoControlButton, Temporary:=True)
cntrl.Caption = "Hello"
cntrl.OnAction = "=MsgBox('Hello')"
cbar.Enabled = True
cbar.Visible = True
Set cbar = Nothing
Set cntrl = Nothing
End Sub
When the code runs, the Add-ins tab appears. It has one group, called
"custom toolbars". My toolbar (with my one control button) does not show in
the
group.
How can I get my toolbar to actually show up?
Sub CreateToolbar()
On Error Resume Next
Application.CommandBars("PracticeCommandBar").Delete
On Error GoTo 0
Dim cbar As Office.CommandBar 'I have the needed reference to Office library
Dim cntrl As Office.CommandBarControl
Set cbar = Application.CommandBars.Add("PracticeCommandBar", msoBarTop, _
Temporary:=True)
Set cntrl = Application.CommandBars("PracticeCommandBar").Controls.Add( _
msoControlButton, Temporary:=True)
cntrl.Caption = "Hello"
cntrl.OnAction = "=MsgBox('Hello')"
cbar.Enabled = True
cbar.Visible = True
Set cbar = Nothing
Set cntrl = Nothing
End Sub
When the code runs, the Add-ins tab appears. It has one group, called
"custom toolbars". My toolbar (with my one control button) does not show in
the
group.
How can I get my toolbar to actually show up?