Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.newusers
|
|||
|
|||
where to insert code in dropdown box?
I have 2 templates, one of them has some dropdowns with a yes or no
selection. What I need to know is where does this code go... I need this dropdown to automatically bring up another document if the answer is "yes"....... If ActiveDocument.FormFields("DropDown1").result = "Yes" Then Documents.Add ("TemplateName.dot") End If I know it needs to relate to the dropdown box in the doc. Could someone explain... Thanks alot. Bill |
#2
Posted to microsoft.public.word.newusers
|
|||
|
|||
where to insert code in dropdown box?
Hi Bill,
General instructions are at http://www.gmayor.com/installing_macro.htm, but you need a bit more than that. In the template that contains the dropdown, open the VBA editor and type this line: Sub ExitDropdown1() When you press Enter at the end of the line, Word will automatically supply the line End Sub Between those two lines, paste the three lines you showed. Also make sure the name "DropDown1" matches the bookmark name shown in the dropdown's Properties dialog, and that "TemplateName.dot" matches the name of the template you want to base the new document on. Change them to match if necessary. Save the template and close the VBA editor. Back in the template, open the dropdown's Properties dialog. Pull down the Exit list and select ExitDropdown1. This sets the connection so that the macro runs when the cursor leaves the dropdown. Save the template again, and create a new document on it to test the dropdown. One other minor bit: The equality test in the macro is case-sensitive. In other words, the choice in the dropdown that makes the new document appear *must* be "Yes" and not "YES" or "yes". There's a way to change the macro's behavior if necessary, but it's easier to just make sure the dropdown has the right case. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. William Millspaugh wrote: I have 2 templates, one of them has some dropdowns with a yes or no selection. What I need to know is where does this code go... I need this dropdown to automatically bring up another document if the answer is "yes"....... If ActiveDocument.FormFields("DropDown1").result = "Yes" Then Documents.Add ("TemplateName.dot") End If I know it needs to relate to the dropdown box in the doc. Could someone explain... Thanks alot. Bill |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I change the HTML code back to WYSIWYG? | Microsoft Word Help | |||
The insert command has stopped working in all my Office productsd | Microsoft Word Help | |||
Mail Merge Field window should remain open to insert multiple fiel | Mailmerge | |||
Insert a file into a merge field | Mailmerge | |||
UPC BAR CODE | Microsoft Word Help |