Custom Menu Add Problem

G

Guest

I have this code in ThisWorkbook in an add in .xla

Private Sub Workbook_Open()
Dim cbWsMenuBar As CommandBar
Dim TrCustom As CommandBarControl
Dim iHelpIndex As Integer

Set cbWsMenuBar = Application.CommandBars("Worksheet Menu Bar")
iHelpIndex = cbWsMenuBar.Controls("Help").Index
Set TrCustom = cbWsMenuBar.Controls.Add(Type:=msoControlPopup,
before:=iHelpIndex)
With TrCustom
.Caption = "Translate"

With .Controls.Add(Type:=msoControlButton)
.Caption = "Refresh Branch List"
.OnAction = "'ERAC_Universal_Translate7x.xla'!Group_Branch"
End With

With .Controls.Add(Type:=msoControlButton)
.Caption = "Refresh Account List"
.OnAction = "'ERAC_Universal_Translate7x.xla'!AccountList"
End With

End With

When I open Excel I briefly see the new menu item on the menu bar but is
disappears when Excel automatically adds a new workbook "Book1". If I run
the private sub after everything is open the menu is added and it works. But
when I close and reopen Excel it doesn't persist. Any idea where I should
look to figure out what is wiping this out?

Thanks,
John
 
D

Dave Peterson

I'd look for a file named *.xlb.

Check to see if you have an extra one in your XLStart (any of them!) folder.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top