Results 1 to 8 of 8
  1. #1
    New Lounger
    Join Date
    Aug 2001
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    "permanently" deleting Cutsom toolbars (word 2000)

    I'm migrating macros from Word 97 to Word 2000 and am confused about deleting a custom toolbar.

    The code which was working in '97:

    CommandBar("customtoolbarname").Delete

    After the code is executed in Word 2000, I list the toolbars and my custom toolbar is NOT in the list. However, if I close my session and start up Word 2000 and list the toolbars, the custom toolbar appears in the list. <img src=/S/doh.gif border=0 alt=doh width=15 height=15>

    I've also tried replacing the above code with the following (with the same results):

    Dim cb As CommandBar

    For Each cb In CommandBars
    If cb.Name = customtoolbarname Then
    cb.Delete
    Exit For
    End If
    Next cb


    tia,
    Rob

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: "permanently" deleting Cutsom toolbars (word 2000)

    Rob,

    What happens if you put "Application." before the statements that refer to CommandBars?

    Gary

  3. #3
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: "permanently" deleting Cutsom toolbars (word 2000)

    If misery loves comapany, you just made me very, very, very happy!!!

    A few days ago, I posted another instance of this bug.
    I started a discussion in microsoft.public.word.vba.general on 14 Aug 2001, Subject: "Double vision, I think not".



    I have a macro that I've used for years, that deletes, then recreates a bunch of toolbars.

    While Word is open everything looks good, but close Word and BOTH the deleted and new toolbars are present next time Word starts.

    I'm running Win 2000 SP 2 and I hasve IE 5.5 SP 2.
    THe macro worked recently, so I expect that the installation of something has caused Word to not delete the handles for the deleted toolbars.

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: "permanently" deleting Cutsom toolbars (word 2000)

    I have created a sample that can be used to replicate the problem I found .

    You may download the template at my URL below.
    Under the topic VBA Bugs and "Features".

  5. #5
    2 Star Lounger
    Join Date
    Dec 2000
    Posts
    188
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: "permanently" deleting Cutsom toolbars (word 2000)

    Should you use CustomizationContext with your CommandBars code?

    J/W

  6. #6
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: "permanently" deleting Cutsom toolbars (word 2000)

    It is being used, it's necessary to control where the changes are made.

    See the Help for CustomizationContext.

  7. #7
    New Lounger
    Join Date
    Aug 2001
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: "permanently" deleting Cutsom toolbars (word 2000)

    Howard,

    After looking through your code, I noticed the Temporary parameter in the CommandBar.Add I had missed before. So I tried adding the parameter and setting it to False and then True. The toolbar does go away when the parameter is set to True.

    Hope it will work for you as well.

    Thanks,
    Rob

  8. #8
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: "permanently" deleting Cutsom toolbars (word 2000)

    Yes, but that's not the point of the exercise. The bug would be even worse if a temporary toolbar did not go away.

    The idea is that there is already an extant toolbar, i.e. not temporary, and a macro is trying to replace that toolbar.

    In this case, Temporary has to be False.

    The code I posted replicates the problem.

Posting Permissions

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