Consulting

Results 1 to 6 of 6

Thread: Returning current context menu in Word 2003

  1. #1

    Returning current context menu in Word 2003

    Hi. I am now certified insane after having tried to resolve this question for several weeks.

    What I want to do is return the name of the current context menu as though I had right-clicked at the selection point. I know how to add menu items to builtin menus like this:

    Set myControl = CommandBars("Text").Controls.Add(Type:=msoControlComboBox, Before:=1)
    With myControl
    .AddItem Text:="First Item", Index:=1
    End With
    End Sub

    but that is not what I want to do as I am not adding a menu item.

    I merely want to return the name of the context menu relevant to the selection point because of the rich information it provides about the place in the document (much better than range, story etc IMHO).

    I have tried things like msgbox(CommandBars.Name) until the cows came home. No luck.

    Thanks in anticipation.

  2. #2
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,710
    Location
    I merely want to return the name of the context menu relevant to the selection point because of the rich information it provides about the place in the document (much better than range, story etc IMHO).
    AFAIK, it does not have a name because it is context sensitive. Say you right click when the Selection is on a field, you get Update Field, Toggle Field Codes etc; if the Selection is on a hyperlink, you get hyperlink stuff, in a blank spot in table, you get table stuff. You know this.

    So no, it is not a different name when it is showing the items for being in a table, a different name when it is on a field etc. etc.

    It is all the same menu...but context sensitive.

    I am VERY curious as to what information you are wanting to get. Could you elaborate?

  3. #3
    Thanks fumei.

    What I am looking for is the rich context sensitive information represented by the builtin menus that are listed if you right-click the menu bar and click Customize, Shortcut Menus.

    I know that some or all of this info is available via various other methods but it would be simpler if I could get it via the shortcut menus.

  4. #4
    Actually, I now realise that I didn't express my requirement very well.

    What I want to do is return the name of the current context menu that the user has clicked or could click.

    Thanks.

  5. #5
    VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,273
    Location
    Hi Jarosite/RustyCocoPat,

    It's rude to post the same question in numersous forums without mentioning this fact. So far, you've posted the same question in:
    http://www.tek-tips.com/viewthread.c...1538154&page=1
    http://www.vbaexpress.com/forum/showthread.php?t=25750
    and
    http://www.wopr.com/index.php?showtopic=761690
    without acknowledging in any of them the advice you've been given in the others.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  6. #6
    My apologies. I wasn't aware of the convention and didn't mean to cause offence. I simply perceived that some people did not have the answer I was seeking and thought that others might.

    Consider the matter closed.

Posting Permissions

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