Results 1 to 2 of 2

Thread: What Sub is custom menu item running? [resolved]

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2001
    Location
    N42 29.340 W71 53.215
    Posts
    422

    Question What Sub is custom menu item running? [resolved]

    I've added some custom menues in Word that invoke various VBA macro/subs.

    But, when I go into the Tools - Customize screen I see no way to determine what sub is attached to any menu item.

    The only way I can figure this out so far is to set a breakpoint in each sub in the VBA IDE, then clicking the menu item to see where it pauses.

    Must be a better way. Thanks, DaveBo
    Last edited by DaveBo; Apr 29th, 2004 at 12:26 PM.
    "The wise man doesn't know all the answers, but he knows where to find them."
    VBForums is one place, but for the really important stuff ... here's a clue 1Tim3:15

  2. #2
    New Member
    Join Date
    Apr 2004
    Posts
    12
    DaveBo,

    Take a look at the OnAction property:


    VB Code:
    1. Sub ButtonList()
    2.     Dim tb As CommandBar
    3.     Dim c As CommandBarButton
    4.     Dim s As String
    5.    
    6.     Set tb = CommandBars("MyToolBar")
    7.    
    8.     For Each c In tb.Controls
    9.         s = s & c.Caption & " - " & c.OnAction
    10.     Next c
    11.    
    12.     MsgBox s
    13.    
    14.     Set c = Nothing
    15.     Set tb = Nothing
    16. End Sub

Posting Permissions

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



Click Here to Expand Forum to Full Width