How to get an word event for a dropdown list in the menu

Posted on 2008-11-19
Last Modified: 2013-11-10
I have a dot file. I have added a custom menu and to the menu I have added a dropdown with:
ActiveDocument.CommandBars("Checkit-med").Controls.Add Type:= msoControlDropdown
The Dropdown Control I have named "ddTM" and in the ThisDocument_Open event I read all Bookmark names into this Dropdown.
Everything works fine till now.

Problem: My goal is, that if the user chooses a Bookmark name in the DropdownControl the Bookmark with the same name as the dropdown text should be selected. The user chooses with the dropdown Control in the menu per example "Bookmark1" an event is triggered and the Bookmark "bookmark1" is selected.

But how can I trigger an event to his dropdown control in the menu?
Or should I use something like Selection.InlineShapes.AddOLEControl ClassType:="Forms.ComboBox.1"?
Then I have an event, but I do not know how to get such an OLEControl into the menu.

Please help.  Thanks for any afford.
Question by:rolandkg1001
    LVL 23

    Accepted Solution

    Try this...
    In your ThisDocument_Open routine add the following to the end (or after where you finish adding the bookmark names to the droplist)
        ActiveDocument.CommandBars("Checkit-med").Controls("dtMM").OnAction = "SelectBookmark"
    Then add the following routine into your VBA code

    Sub SelectBookmark()
    End Sub

    Open in new window


    Author Closing Comment

    Thanks, you helped me a lot!!!!

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
    Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
    This video walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.
    This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now