![]() |
|
#4
|
||||
|
||||
|
First, you would need to create each of your dependent dropdown content controls, each in its own paragraph. Then you would create a custom Quick Part from each of those paragraphs (see http://office.microsoft.com/en-us/wo...010370568.aspx). Next, you'd delete those from the document and create the dropdown you'll use to choose the various options. Then, insert a continuous Section break immediately before where the dependent dropdown is to be inserted. Finally, you'd add a macro to the document's 'ThisDocument' module, coded along the lines of:
Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim StrNm As String
With ContentControl
If .Title <> "Dropdown 1" Then Exit Sub
Select Case .Range.Text
Case "Item 1": StrNm = "Fruit"
Case "Item 2": StrNm = "Game"
Case Else: StrNm = ""
End Select
End With
With ActiveDocument.Sections(2).Range.ContentControls(1)
.LockContentControl = False
.Delete
End With
If StrNm = "" Then Exit Sub
Application.Templates("C:\Users\" & Environ("UserName") & _
"\Documents\Misc\Office Config\Word\Normal.dotm"). _
BuildingBlockEntries(StrNm).Insert RichText:=True, _
Where:=ActiveDocument.Sections(2).Range.Characters.First
End Sub
• "Dropdown 1" is the title property of the master dropdown • "Item 1" & "Item 2" are the master dropdown entry names • "Fruit" & "Game" are the corresponding custom Quick Part names. • the custom Quick Parts are stored in Word's 'Normal' template. • the target Section is Section 2.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Form field selection allows entry into form text box
|
David C | Word | 1 | 10-24-2012 04:53 AM |
Can't tab from field to field in form
|
Lynieee | Word | 6 | 06-18-2012 02:37 PM |
| Word form field | JBaker | Word | 18 | 03-22-2012 09:05 AM |
Form Fields - Create blank form text field with if statement?
|
LAssist2011 | Word | 5 | 12-14-2011 03:02 PM |
| Form Field Shading. | Ninerhoss | Word | 0 | 11-23-2010 02:40 PM |