

- TEXT FORM FIELD WORD 2013 IN VBA HOW TO
- TEXT FORM FIELD WORD 2013 IN VBA CODE
- TEXT FORM FIELD WORD 2013 IN VBA PASSWORD
TEXT FORM FIELD WORD 2013 IN VBA PASSWORD

(Or, click Properties in the Controls group on the Developer tab.) Right-click ddRegion and choose Properties.You need to tell the state dropdown to execute the new procedure you just added, as follows: Add "Maine" End With Case "West" With ActiveDocument.FormFields("ddState").DropDown.ListEntries. Add "Texas" End With Case "East" With ActiveDocument.FormFields("ddState").DropDown.ListEntries. Add "Ohio" End With Case "South" With ActiveDocument.FormFields("ddState").DropDown.ListEntries. Sub PopulateddState() Select Case ActiveDocument.FormFields("ddRegion").Result Case "North" With ActiveDocument.FormFields("ddState").DropDown.ListEntries. Click Save on the Standard toolbar and then click Yes.Enter the PopulateddState sub procedure shown below.Launch the Visual Basic Editor (VBE) by pressing +.To populate ddState, add the VBA procedure below, as follows: Next, right-click the state dropdown field and name it ddState (using the Bookmark control, as you just did to name the first dropdown ddRegion.) Click OK to close the dialog box.Īt this point, you have one populated dropdown named ddRegion and a second dropdown named ddState, that’s still empty.
TEXT FORM FIELD WORD 2013 IN VBA CODE
You don’t have to rename the dropdown field, you can retain the default, but giving it a descriptive and meaningful name will make the code easier to maintain. Don’t skip this step – when I receive mail about these types of techniques, more often than not the reader has missed this step.
TEXT FORM FIELD WORD 2013 IN VBA HOW TO
(If you don’t know how to enable the Developer tab, read How to: Show the Developer Tab on the Ribbon. In Word, open a blank document and click the Developer tab.The first step is to create the user form and add a couple of form fields, as follows: Then, we’ll use a VBA Select Case statement to populate a second list with a few states from the selected region. To illustrate this dependent list solution, we’ll populate a primary list with region items: North, South, East, and West.

LEARN MORE: Office 365 Consumer pricing and features For this example, we’ll stick with the simpler solution and hard-code the items. The latter is more dynamic, but requires more code and a database. Or, you can retrieve the appropriate list items from a database. You can hard-code list items in a VBA procedure to populate the secondary (dependent) list. Occasionally, the selection in one field determines the contents of another. Many templates and web forms use Word form fields to solicit information from the user. The new Gmail interface has arrived, and it’s cleaner than ever Get lifetime access to Microsoft Office 2021 for just $50 The 10 best antivirus products you should consider for your business How Russia’s invasion of Ukraine will affect your cybersecurity Use VBA code to populate a dependent form field in Microsoft Word. How to populate a dependent dropdown list in Word
