View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tony Tony is offline
external usenet poster
 
Posts: 62
Default how to remove command bar button

How I can remove the custom command bar which I want to
add automaticaly when excel file is open.
Adding is done by the following procedu

Sub Workbook_Open()

Dim c As CommandBar
Dim cb As CommandBarButton
Dim cp As CommandBarPopup

On Error Resume Next
Set c = Application.CommandBars("Worksheet Menu Bar")
If Not c Is Nothing Then
Set cb = c.Controls.Add(msoControlButton, 2)
cb.Style = msoButtonCaption
cb.Caption = "Calculate Totals"
cb.OnAction = "Template 4.xls!
ThisWorkbook.Calculate"
End If

End Sub

Thanks for help.

Regards,

Tony