Trying to get Word to replace values in drop down list with symbols/pictures within the same document.

Hi everybody.

I have a question about a template I'm creating.

I have a table, where I have created a drop down list using the developer-mode.

I would like the values from the drop down list to link to symbols located in the document itself, when you click them. 

Example: I have a danger-symbol, and I have a drop down list with the text "danger". When I click the danger-text, it would be awsome, if Word could replace the Danger-text with the Danger-symbol.

** I know it's easier to use copy+paste, but it's not only me, that has to use this template.

Hope you guys can help..

Kind regards, Thomas Denmark.

* Please try a lower page number.

* Please enter only numbers.

* Please try a lower page number.

* Please enter only numbers.

A convenient solution to this is to use Insert>Quick Parts to store the graphics. By default, the Save in: location should be stored in your template. You do not want it in Building Blocks.dotx, as that won't travel with your template.

Then your dropdown can call a macro that chooses a Quick Part depending on the chosen index of the dropdown and insert that using a line like:

Application.Templates("C:\MyTemplate.dotm").BuildingBlockEntries("Danger").Insert Where:=Selection.Range, RichText:=True

By default, Quick Parts are inserted in the same location as they were in when you added it to Quick Parts. By default, this location is relative to the paragraph to which is was anchored. You can get a absolute location on the page if you select the object, then edit its position to use Absolute position and set to the right of and below to Page. Then add it to Quick Parts. When inserted using VBA, it will appear at the same place on the page every time.

Author of "OOXML Hacking - Unlocking Microsoft Office's Secrets", ebook now out
John Korchok, Production Manager
production@brandwares.com

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi John.

Thanks alot for your quick reply. 

I'm not a super-user, but I think I understand what the idea is behind your explanation. 

Could you maybe a little more specific about what the approach is to doing this? 

Kind regards from Thomas.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Another solution, similar to John's, is an AutoTextList field. This allows you to select from a menu of AutoText entries. You would save each of your graphics as an AutoText entry with the name you want to appear in the list. For instructions, see http://word.mvps.org/FAQs/TblsFldsFms/AutoTextList.htm.
Microsoft MVP (Word) since 1999
Fairhope, Alabama USA
http://ssbarnhill.com
http://wordfaqs.ssbarnhill.com
Screen shots captured with TechSmith's Snagit

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Suzanne.

Thank you for your suggestion. 

I think the functionality of the template, i'm trying to create will be lost with the autotext function.

Can you in some simple steps explain how to make the values in a drop down list change into a symbol/picture within the document?

This is what I'm trying to accomplish.

Kind regards from Thomas. 

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

When you insert an AutoText entry, what you get is whatever is stored in that entry. For example, if you have an entry stored with the name "danger," then when you insert it, you get the stored content (your symbol). The AutoTextList field allows you to have a dropdown menu of AutoText entries from which you can choose the one you want. The referenced article explains exactly how to set this up.

Of course, if you have only a few entries, it would be easier just to type the entry name (you wouldn't want to use a real word, but you could call it /dgr) and press Enter when you get the AutoComplete tip.

Even easier would be to save /dgr as a formatted AutoCorrect entry so that /dgr would automatically be replaced by your symbol. Whether the latter will work or not depends on whether your "symbol" is actually a font character or a graphic image; I'm not sure the latter can be saved as AutoCorrect entries.

Microsoft MVP (Word) since 1999
Fairhope, Alabama USA
http://ssbarnhill.com
http://wordfaqs.ssbarnhill.com
Screen shots captured with TechSmith's Snagit

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

To expand on Susan's reply, I've created a demo template that shows an AutoTextList in action, so you can see how it works: Sample AutoTextList Template. Please note, the link will open this in Word Online, which can't display the AutoTextList. Click on the 3 dots in the upper right corner of the OneDrive screen and choose Download. Then open it in Word on your desktop to try it.

The list can insert one of 3 graphics that are stored in AutoText. This is probably the least technically demanding approach. You can do similar things with macros and form fields, but since you're not already a programmer that would get complicated fast.

Author of "OOXML Hacking - Unlocking Microsoft Office's Secrets", ebook now out
John Korchok, Production Manager
production@brandwares.com

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hey John. 

Thank you very much for the demo.

It makes a lot of sense. 

Just to make clear, what I'm am trying to do, I have attached a picture from my word document. :)

If i pick the danger button from the drop down, it would be awsome, if the danger symbol would be inserted in the "type-cell".

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hey Suzanne. 

Your explanation makes a lot of sense. 

Just to make clear, what I'm am trying to do, I have attached a picture from my word document. :)

If i pick the danger button from the drop down, it would be awsome, if the danger symbol would be inserted in the "type-cell".

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

You can use the content control event to run a macro when you leave the dropdown e.g.

Let's assume that you have two dropdowns in the table titled Symbol1 and Symbol2. Put the following code in the ThisDocument module of the document and save as macro enabled.

The macro assumes that the two row table with the pictures is Table(1) and that the table with the dropdown is Table(2).

The macro analyses your selection in the dropdown and replaces the dropdown with the illustration from the first table.  See http://gregmaxey.mvps.org/word_tip_pages/insert_content_with_content_controls.html for more information

Option Explicit
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, _
                                          Cancel As Boolean)
Dim oTable As Table
Dim oPictureTable As Table
Dim oRng As Range
Dim oIcon As Range
    Set oPictureTable = ActiveDocument.Tables(1) 'The table with the pictures
    Set oTable = ActiveDocument.Tables(1) 'The table with the dropdowns
    Set oRng = ContentControl.Range.Cells(1).Range
    oRng.End = oRng.End - 1
    Select Case ContentControl.Title
        Case "Symbol1", "Symbol2" 'The names of the dropdowns
            Select Case ContentControl.Range.Text
                Case Is = "Danger"
                    oPictureTable.Cell(2, 1).Range.InlineShapes(1).Range.Copy
                Case Is = "PPE"
                    oPictureTable.Cell(2, 2).Range.InlineShapes(1).Range.Copy
                Case Is = "Caution"
                    oPictureTable.Cell(2, 3).Range.InlineShapes(1).Range.Copy
                Case Is = "Control"
                    oPictureTable.Cell(2, 4).Range.InlineShapes(1).Range.Copy
                Case Is = "Info"
                    oPictureTable.Cell(2, 5).Range.InlineShapes(1).Range.Copy
                Case Is = "Operation"
                    oPictureTable.Cell(2, 6).Range.InlineShapes(1).Range.Copy
                Case Is = "Setup"
                    oPictureTable.Cell(2, 7).Range.InlineShapes(1).Range.Copy
                Case Is = "Tools"
                    oPictureTable.Cell(2, 8).Range.InlineShapes(1).Range.Copy
                Case Is = "Transport"
                    oPictureTable.Cell(2, 9).Range.InlineShapes(1).Range.Copy
            End Select
            ContentControl.Delete
            oRng.Paste
    End Select
End Sub

Graham Mayor (Microsoft Word MVP 2002-2019)
For more Word tips and downloads visit my web site
https://www.gmayor.com/Word_pages.htm

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

It appears to me that you are needing to have this selection for the first cell in each row of an extensive table. I think putting either a content control or an AutoTextList field in every single cell would be overkill. Instead, it would make more sense to have some sort of custom menu or toolbar containing each of the symbols. This would be relatively easy to do in Word 2003 and earlier; you could save each icon as an AutoText entry and create a custom toolbar with the icon as the button image for each AutoText entry. Though this would be more difficult in Word 2007 and above, I think it could be done in Word 2010/2013 with a custom Ribbon tab or perhaps with Greg Maxey's AutoText add-in.

But all of this is overkill if you are the only person who is going to be using this feature. If it doesn't need to be made obvious and intuitive for just anyone to use, then I still maintain that just saving each icon as an AutoText entry and inserting the relevant one using AutoComplete or a keyboard shortcut would be the easiest solution.

Microsoft MVP (Word) since 1999
Fairhope, Alabama USA
http://ssbarnhill.com
http://wordfaqs.ssbarnhill.com
Screen shots captured with TechSmith's Snagit

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

* Please try a lower page number.

* Please enter only numbers.

* Please try a lower page number.

* Please enter only numbers.

 
 

Question Info


Last updated October 5, 2021 Views 2,521 Applies to: