Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Mar 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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:=msoControlC omboBox, 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
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Welcome to the Lounge!

    I don't think this information is exposed in Word VBA. You'd have to inspect Selection.Information to check the properties of the selection, and deduce from that which context menu would be displayed.

  3. #3
    New Lounger
    Join Date
    Mar 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='766182' date='19-Mar-2009 07:30']Welcome to the Lounge!

    I don't think this information is exposed in Word VBA. You'd have to inspect Selection.Information to check the properties of the selection, and deduce from that which context menu would be displayed.[/quote]

    Thanks HansV. However, I don't believe this information is deducible from Selection.Information.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    [quote name='Jarosite99' post='766186' date='19-Mar-2009 12:42']Thanks HansV. However, I don't believe this information is deducible from Selection.Information.[/quote]
    I fear that what you want isn't really possible. Sorry!

  5. #5
    New Lounger
    Join Date
    Mar 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='766189' date='19-Mar-2009 08:21']I fear that what you want isn't really possible. Sorry![/quote]

    OK. Many thanks Hans.

    Cheers.

Posting Permissions

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