Consulting

Results 1 to 6 of 6

Thread: Solved: Unable to delete custom toolbar created in excel 2003.

  1. #1
    VBAX Regular
    Joined
    Dec 2008
    Posts
    86
    Location

    Smile Solved: Unable to delete custom toolbar created in excel 2003.

    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
    [VBA]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
    [/VBA]
    thanks in advance
    Regards,
    Kishlaya

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]
    On Error Resume Next
    Application.Commandbars("IP").Delete
    On Error Goto 0
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Dec 2008
    Posts
    86
    Location
    Dear XLD
    I have already tried that, but it does not delte the custom toolbar while closing the workbook. it istill creating new buttons whenever i open the workbook
    Kishlaya

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Is your other code called by Workbook_Open?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Regular
    Joined
    Dec 2008
    Posts
    86
    Location
    yes that is in workbook_open module.

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Then it will recreate it every time that you open the workbook.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •