Chào mừng bạn đến blog Ynghialagi.com Trang Chủ

Table of Content

How do I populate a dependent drop down list in Word?

Ease of Use

Intermediate

Version tested with

Submitted by:

fumei

Description:

Create form fields that, when one is selected, the options under the second one change. Also called cascading dropdowns.

Discussion:

Suppose you have a form you've created using the Forms toolbar. In it you have a dropdown for each department in your company. But once the person using the form chooses the department, you want them to choose a specific supervisor in that department. That means that the values showing in the second dropdown box are dependent on the value chosen in the first dropdown box. You CAN do it, and here's how.

Code:

instructions for use

How to use:

  1. Copy the code above.
  2. Open your document in Word.
  3. Hit Alt+F11 to open the Visual Basic Editor (VBE) window.
  4. On the left, double-click the project with your document's name.
  5. From the menu, choose Insert-Module.
  6. Paste the code into the window that appears on the right.
  7. Edit it as necessary for your values.
  8. Hit the little diskette button to save your code into the document and close the VBE window.

Test the code:

  1. Create your dropdown form fields as you normally would.
  2. Protect your document for forms.
  3. Choose one of your options from the first dropdown box, and hit tab. Your second dropdown box should now provide only those options you've provided for that list.

Sample File:

conditional2.zip 8.49KB

Approved by mdmackillop

Video liên quan

Post a Comment