Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-29-2015, 02:16 PM
macropod's Avatar
macropod macropod is offline VBA coding for multiple drop-down lists to populate a text box for each list Windows 7 64bit VBA coding for multiple drop-down lists to populate a text box for each list Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,372
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

That code looks suspiciously like some I've posted here...



To work with multiple content controls, you could tag each of the output ones to match the titles of the ones you're using for the inputs, then use code like:
Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim i As Long, StrDetails As String
With ContentControl
  Select Case .Title
    Case Is = "Choice1"
      For i = 1 To .DropdownListEntries.Count
        If .DropdownListEntries(i).Text = .Range.Text Then
          StrDetails = Replace(.DropdownListEntries(i).Value, "|", Chr(11))
          Exit For
        End If
      Next
      ActiveDocument.SelectContentControlsByTag("Choice1").Item(1).Range.Text = StrDetails
    Case Is = "Choice2"
      For i = 1 To .DropdownListEntries.Count
        If .DropdownListEntries(i).Text = .Range.Text Then
          StrDetails = Replace(.DropdownListEntries(i).Value, "|", Chr(11))
          Exit For
        End If
      Next
      ActiveDocument.SelectContentControlsByTag("Choice2").Item(1).Range.Text = StrDetails
    Case Else
  End Select
End With
End Sub
Note: You would really only need:
StrDetails = Replace(.DropdownListEntries(i).Value, "|", Chr(11))
if the output has multiple lines; otherwise you could use just:
StrDetails = .DropdownListEntries(i).Value
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 09-30-2015, 12:51 AM
yeatropulo yeatropulo is offline VBA coding for multiple drop-down lists to populate a text box for each list Windows XP VBA coding for multiple drop-down lists to populate a text box for each list Office XP
Novice
VBA coding for multiple drop-down lists to populate a text box for each list
 
Join Date: Aug 2015
Posts: 8
yeatropulo is on a distinguished road
Default Thank you

Sorry... your suspicions are correct, being new to all this and out of desperation I may have inadvertently copied the code from another post you answered. Thank you for your quick reply I will give it a go and let you know.
Reply With Quote
  #3  
Old 09-30-2015, 01:25 AM
macropod's Avatar
macropod macropod is offline VBA coding for multiple drop-down lists to populate a text box for each list Windows 7 64bit VBA coding for multiple drop-down lists to populate a text box for each list Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,372
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by yeatropulo View Post
out of desperation I may have inadvertently copied the code from another post you answered.
That's quite OK. Anyone posting code on websites should expect others might make use of it.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate Word Drop-down list with Excel column then auto fill form fields with Excel data Faldinio Word VBA 7 10-19-2014 06:03 AM
Link multiple cells in drop-down lists Trial4life Excel 0 09-08-2014 05:08 AM
VBA coding for multiple drop-down lists to populate a text box for each list Multiple Choice Drop Down List teza2k06 Word 1 04-29-2014 04:54 PM
Multiple Drop Down Lists in word ali212006 Word 3 03-13-2013 12:16 PM
Using both drop down lists and blank cells for text voltarei Word 0 03-18-2010 04:16 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:00 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft