Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Toolbar won't become visible! (WinXP/Word2003)

    Can someone point me in the direction of some reasons why a toolbar would refuse to become visible?!

    I'm updating some templates done externally by someone who didn't check their code at all (found a spelling mistake in one that meant it wouldn't compile - how they could send that over as a working template and get away with it I don't know!) and at one point it creates a toolbar using the following code:

    <pre>ActiveDocument.CommandBars.Add "MGFSP", , , True
    With ActiveDocument.CommandBars("MGFSP")
    .Controls.Add msoControlButton, 186
    With .Controls(1)
    .Caption = "Q11"
    .TooltipText = "Points to Prove"
    .OnAction = "Module1.ResumeQ11"
    .Style = msoButtonIconAndCaption
    End With
    .Controls.Add msoControlButton, 186
    With .Controls(2)
    .Caption = "Q12"
    .TooltipText = "Additional Information"
    .OnAction = "Module1.ResumeQ12"
    .Style = msoButtonIconAndCaption
    End With
    .Enabled = True
    .Visible = True
    End With</pre>


    In the original this bit works fine, once I changed the font and corrected some bookmark placings it falls over with a debug error on the .visible line saying "method 'visible' of object 'commandbar' failed" - and I can't work out why!

    I presume I've made some small change somewhere that has upset it but I honestly can't think what it could be, so if someone could give me some hints as to what could cause this error I'd be grateful, then maybe something will ring a bell somewhere ... The original didn't have the .enabled line, by the way, but the help says .visible won't work if it's not enabled so I put that in in case; it doesn't seem to make any difference, though!

    Many thanks in advance!
    Beryl M


  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Toolbar won't become visible! (WinXP/Word2003)

    There is nothing wrong with this code by itself - it runs without error and produces a visible toolbar when I try it. So it must be interfering with something else...

    (.Enabled = True isn't really necessary - a newly created toolbar is hidden and enabled by default)

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Toolbar won't become visible! (WinXP/Word2003)

    Thanks Hans - I don't know what it was, but I had to close down Word a bit later and when I reopened it the template behaved! I still don't know what caused it, but it works now!
    Beryl M


Posting Permissions

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