G
Grumpy
Word 2003
When I add a control button to the "Tools" menu the button does not appear
until I click on 'View -> Toolbars -> customize -> then open the 'Tools'
menu and then close the customize session.
What am I doing wrong please?
Sub AddMenu()
Dim myMenubar As CommandBar
Dim ACCRControl, ctl, myControl As CommandBarControl
Set myMenubar = CommandBars.ActiveMenuBar
Set myControl = myMenubar.Controls(6)
For Each ctl In myControl.Controls
If ctl.Caption = "Load ACCRs" Then
Exit Sub
End If
Next
Set ACCRControl = myControl.Controls.Add _
(Type:=msoControlButton, _
ID:=1, temporary:=False)
With ACCRControl
.Caption = "Load ACCRs"
.DescriptionText = "Loads ACCRs from list in table"
.OnAction = "LoadACCRs"
.Enabled = True
.Visible = True
End With
End Sub
When I add a control button to the "Tools" menu the button does not appear
until I click on 'View -> Toolbars -> customize -> then open the 'Tools'
menu and then close the customize session.
What am I doing wrong please?
Sub AddMenu()
Dim myMenubar As CommandBar
Dim ACCRControl, ctl, myControl As CommandBarControl
Set myMenubar = CommandBars.ActiveMenuBar
Set myControl = myMenubar.Controls(6)
For Each ctl In myControl.Controls
If ctl.Caption = "Load ACCRs" Then
Exit Sub
End If
Next
Set ACCRControl = myControl.Controls.Add _
(Type:=msoControlButton, _
ID:=1, temporary:=False)
With ACCRControl
.Caption = "Load ACCRs"
.DescriptionText = "Loads ACCRs from list in table"
.OnAction = "LoadACCRs"
.Enabled = True
.Visible = True
End With
End Sub