Consulting

Results 1 to 5 of 5

Thread: Auto Populate Text On Dependent Drop Down Exit

  1. #1

    Auto Populate Text On Dependent Drop Down Exit

    I have created a form built around dependent drop down lists. Drop down 1 feeds drop down 2 feeds drop down 3. I was not aware that text wrap does not work in drop down fields, so my 3rd drop down field isn't going to work as I had planned. What I would like to do instead is replace the 3rd drop down field with a text field that automatically populates with text based on the selection made in drop down 2. The end document will be used by multiple employee's, so I would like to code all of this through VBA into the document rather than using a select file method to reference documents on my personal computer. Just an example of the code I used for the first 2 drop downs for a point of reference:
    Sub PopulateddPIP()
    
    
    Select Case ActiveDocument.FormFields("ddKPI").Result
    
    
    Case "ACW"
    
    
    With ActiveDocument.FormFields("ddPIP").DropDown.ListEntries
    
    
    .Clear
    
    
    .Add "Not Multi Tasking"
    
    
    .Add "Not Using Call Hx Templates"
    
    
    .Add "Distracted by Personal Phone or Internet"
    
    
    End With
    Where drop down 1 is bookmarked as "ddKPI" and drop down 2 is bookmarked as "ddPIP". Any and all help is appreciated.

    Thanks in advance.

  2. #2
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,340
    Location
    Sub DD2OnExit()
      Select Case ActiveDocument.FormFields("DDPIP").Result
        Case "a": ActiveDocument.FormFields("DependentText").Result = "Apples"
        Case "b": ActiveDocument.FormFields("DependentText").Result = "Blueberries"
        Case "c": ActiveDocument.FormFields("DependentText").Result = "Cherries"
       End Select
    lbl_Exit:
      Exit Sub
    End Sub
    Greg

    Visit my website: http://gregmaxey.com

  3. #3
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  4. #4
    Quote Originally Posted by gmaxey View Post
    Sub DD2OnExit()
      Select Case ActiveDocument.FormFields("DDPIP").Result
        Case "a": ActiveDocument.FormFields("DependentText").Result = "Apples"
        Case "b": ActiveDocument.FormFields("DependentText").Result = "Blueberries"
        Case "c": ActiveDocument.FormFields("DependentText").Result = "Cherries"
       End Select
    lbl_Exit:
      Exit Sub
    End Sub
    Greg - thank you very much for the example code. This works perfectly for this case. Marking thread as answered.

  5. #5
    My sincerest apologies, Paul. It was not my intention to flagrantly disregard the rules. I've read through them to ensure this does not happen again in the future. Again, very sorry. Thank you for all of your help sir.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •