View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
R. Choate R. Choate is offline
external usenet poster
 
Posts: 106
Default Adding & removing menu buttons

I have code in my "This Workbook" module to add 2 buttons to the menu bar. Here is the current code for that:

With CommandBars("Worksheet Menu Bar").Controls.Add
.Caption = "Box Units"
.Style = msoButtonCaption
.OnAction = "NameBoxes"
End With

With CommandBars("Worksheet Menu Bar").Controls.Add
.Caption = "Clear Sheets"
.Style = msoButtonCaption
.OnAction = "ClearAll"
End With

I need to replace this with better code AND add code to my BeforeClose event to delete the buttons. The kicker is that there might
be several copies of each button if the user has opened more than one copy of the file or has opened it multiple times. I need to
have the code delete all possible instances (copies) of each of these 2 buttons. Any good ideas?

--
RMC,CPA