Results 1 to 6 of 6
  1. #1
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Invisible Menu Item (97)

    Hi All,

    It's late here but this was done a few hours ago when I still had some sanity.

    I was playing around with
    Commandbars("Menu Bar").Controls(x).Caption

    in the debug window, where x is a number.

    I thought I could count at least up to 10.

    When x=7, I get T&able. OK this makes sense.

    What I see next on my menu bar is Window, so the above command with x=8 should give me &Window. Right? Wrong! I know that Word isn't Excel, but can't it count to 10?

    Instead I got A&ction. There is no Action menu on my Menu Bar. Where did this come from? Checking in Customize for my Built-in Menus or any other category, there just ain't any Action item! Any ideas of where this came from? I don't recall ever having an Action item on the menu bar on this PC (although I won't swear to it)!

    FYI: x=9 gives &Window.

    TIA

    Fred

  2. #2
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Invisible Menu Item (97)

    There appear to be various features in each object model that are not yet enabled - see the last few posts in this recent Word thread. If you want to quantify this further, try these two code snippets: <pre>Sub ComBarControlsList()
    For i = 1 To CommandBars([target bar]).Controls.Count
    Debug.Print i & " " & CommandBars([target bar]).Controls(i).Caption
    Next i
    End Sub

    Sub ComBarSubControlsList()
    For i = 1 To CommandBars([target bar]).Controls([x]).Controls.Count
    Debug.Print i & " " & CommandBars([target bar]).Controls([x]).Controls(i).Caption
    Next i
    End Sub
    </pre>

    If you want to look at the Command Bars themselves, try Brooke's code at this Excel post.

    FWIW the "Action" control you mention remains "hidden" in Word 2000.
    Gre

  3. #3
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: Invisible Menu Item (97)

    Thanks.

    Silly me thinking the object model is logical and complete. I should have known better!

    I'll give your 2 snippets a whirl.

    Another question:
    I can go thru the collection of commandbars and check:

    <pre>Dim showtb As String
    Dim cbr As CommandBar
    For Each cbr In CommandBars
    On Error Resume Next
    If cbr.Builtin Then
    cbr.Visible = True
    showtb = MsgBox("Do you want to keep the """ & cbr.Name & """ toolbar visible?", _
    vbYesNoCancel + vbDefaultButton2, "Show Toolbar?")
    If showtb = vbCancel Then Exit Sub
    If showtb = vbNo Then cbr.Visible = False
    End If
    Next cbr
    </pre>



    This will show cb's such as Edit Picture. Even if I want to make this visible, it won't be since the context doesn't seem right at the moment (not editing a picture). Fine.

    But I'd like to skip those cb's that I can't make visible at the moment. So I changed above test to
    if cbr.enabled

    This seemed to skip Edit Picture (good) but still showed End Notes and Display Fields. But even if clicking Yes, those cb's don't become visible.

    How can I create the test so that only those cb's that can be made visible are true in the test? I didn't see any property that seemed to fit the bill.

    Thanks.

    Fred

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: Invisible Menu Item (97)

    Hi Unkamunka,

    I tried the 2 code snippets substituting "Standard" for [target bar]. The first one gave me what I expected. The second one, which the above substitution and changing [x] to 1, gave me an error. Was that the correct change? What was supposed to happen?

    Fred

  5. #5
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Invisible Menu Item (97)

    Fred - re visibility: At the moment your code is calling all CommandBars, including PopUps (such as Endnotes). If you add an extra If Statement:

    If cbr.Type = msoBarTypeNormal Then

    you should filter your list down to what you're looking for.

    re the code snippets: Perhaps I could have explained more fully - the second one is only necessary where you have a SubControl - (such as in the Menu Bar and parts of the Drawing and Web toolbars). HTH
    Gre

  6. #6
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: Invisible Menu Item (97)

    Unkamunka,

    Yep that did the trick.

    Now I understand the 2nd snippet too.

    Thanks much.

    Fred

Posting Permissions

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