View Single Post
 
Old 01-13-2015, 09:13 PM
macropod's Avatar
macropod macropod is online now Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,343
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The macro I posted in the link you gave is only for populating the dropdown; not for doing anything with whatever might be selected. If you select an item from the populated dropdown, that item should be displayed.

If you want to work with (e.g. display) something else from the workbook according to the item selected, you should add whatever that is to the dropdown as the item Value when populating the content control. For example:
Code:
ActiveDocument.ContentControls(1).DropdownListEntries.Add Text:=Trim(.Range("A" & i)), Value:=Trim(.Range("B" & i))
Then, when you exit the content control after making your selection, use a Document_ContentControlOnExit macro to retrieve the value and put it somewhere else. For code to do that, see: https://www.msofficeforums.com/word-...html#post46903. You already seem to be doing much the same.

For what you're trying to do, if there is always only one chart to display in a given document, could have the field code already in the document and just change the chart reference (that being what you'd use for the content control Value).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote