Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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

Posted on 2008-11-19
Medium Priority
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

irudyk earned 2000 total points
ID: 22998334
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

ID: 31518351
Thanks, you helped me a lot!!!!

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This video walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…

572 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