kishlaya
07-10-2009, 02:00 AM
I have a toolbar which i created in excel 2007. now it comes as a custom toolbar in the Addin ribbon in excel 2007. the procedure for creating this i have put in the Workbook_open module so that whenever this particular workbook is open the button is available. but now i am not able to delete the the button . i am looking for some code to put in workbook_beforeclose which will delete the code the button as soon as i close the workbook since each time i open the workbook it adds another button.
the code for creating the button is
Sub CreateMenubar()
On Error Resume Next
Dim iCtr As Long
Dim MacNames As Variant
Dim CapNamess As Variant
Dim TipText As Variant
With Application.CommandBars.Add
.Name = "IP"
.Left = 200
.Top = 200
.Protection = msoBarNoProtection
.Visible = True
.Position = msoBarFloating
With .Controls.Add(Type:=msoControlButton)
.OnAction = "wizard"
.Caption = "IP Report Generation"
.Style = msoButtonIconAndCaption
.FaceId = 7
End With
End With
End Sub
Sub wizard()
frmTool.Show False
End Sub
thanks in advance
Regards,
Kishlaya
the code for creating the button is
Sub CreateMenubar()
On Error Resume Next
Dim iCtr As Long
Dim MacNames As Variant
Dim CapNamess As Variant
Dim TipText As Variant
With Application.CommandBars.Add
.Name = "IP"
.Left = 200
.Top = 200
.Protection = msoBarNoProtection
.Visible = True
.Position = msoBarFloating
With .Controls.Add(Type:=msoControlButton)
.OnAction = "wizard"
.Caption = "IP Report Generation"
.Style = msoButtonIconAndCaption
.FaceId = 7
End With
End With
End Sub
Sub wizard()
frmTool.Show False
End Sub
thanks in advance
Regards,
Kishlaya