![]() |
|
#4
|
||||
|
||||
|
Assuming the list box is titled 'Country' and the others are titled "Short Name" the following macro in he thisdocument module will fill the short name fields with the selection from the country as US or MEX. You may find Insert Content Control Add-In useful
Code:
Option Explicit
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim oCC As ContentControl
If ContentControl.ShowingPlaceholderText = False Then
If ContentControl.Title = "Country" Then 'the title of the list box control
Select Case Trim(ContentControl.Range.Text)
Case "United States"
For Each oCC In ActiveDocument.ContentControls
If oCC.Title = "Short Name" Then 'the title of the fields used for the short version
oCC.Range.Text = "US"
End If
Next oCC
Case "Mexico"
For Each oCC In ActiveDocument.ContentControls
If oCC.Title = "Short Name" Then
oCC.Range.Text = "MEX"
End If
Next oCC
'etc
End Select
End If
End If
Set oCC = Nothing
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
| Tags |
| dropdown, form fill, legacy form |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Activate (show) a Drop-down form field when another drop-down form field is selected from | Jentis | Word VBA | 1 | 04-19-2018 09:42 PM |
Auto Populate Text On Dependent Drop Down Exit
|
GregStewartPTC | Word VBA | 2 | 02-27-2017 05:37 AM |
| make text form field active dependent on dropdown | Glenn0004 | Word VBA | 1 | 06-23-2015 06:13 PM |
| form control Field - Drop down auto text | mrtinfl | Word | 5 | 11-19-2014 06:57 AM |
Form Field - Drop down selection causing auto text
|
chesspupil | Word VBA | 7 | 05-09-2010 05:43 AM |