Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 12-14-2018, 06:50 AM
gmaxey gmaxey is offline Changing words depending on the dropdown list Windows 10 Changing words depending on the dropdown list Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,601
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Use the one you wish. I am not competing with anyone here for points. Clearly you didn't pay much attention as you changed selection because the text did change and behave exactly as it does with the first solution.


If you want to be more creative with the change you could use something like this:


Code:
Private Sub Document_ContentControlBeforeStoreUpdate(ByVal ContentControl As ContentControl, Content As String)
Dim oNode As CustomXMLNode
Dim lngIndex As Long
  If ContentControl.Tag = "Master" Then
    Select Case Content
      Case 1
         For lngIndex = 1 To 5
           Set oNode = ContentControl.XMLMapping.CustomXMLPart.SelectSingleNode(Replace(ContentControl.XMLMapping.XPath, "Master", "Slave" & lngIndex))
           Select Case lngIndex
             Case 1: oNode.Text = "One, two buckle my shoe"
             Case 2: oNode.Text = "three, four shut the door"
             Case 3: oNode.Text = "five, six pick up sticks"
             Case 4: oNode.Text = "seven, eight close the gate"
             Case 5:  oNode.Text = "nine, ten the big fat hen."
           End Select
        Next lngIndex
      Case 2
         For lngIndex = 1 To 5
           Set oNode = ContentControl.XMLMapping.CustomXMLPart.SelectSingleNode(Replace(ContentControl.XMLMapping.XPath, "Master", "Slave" & lngIndex))
           Select Case lngIndex
             Case 1: oNode.Text = "one little, two little"
             Case 2: oNode.Text = "three little, four little"
             Case 3: oNode.Text = "five little, six little"
             Case 4: oNode.Text = "seven little, eight little"
             Case 5:  oNode.Text = "nine little, ten little (you pick) boys."
           End Select
        Next lngIndex
      Case 3
         For lngIndex = 1 To 5
           Set oNode = ContentControl.XMLMapping.CustomXMLPart.SelectSingleNode(Replace(ContentControl.XMLMapping.XPath, "Master", "Slave" & lngIndex))
           Select Case lngIndex
             Case 1: oNode.Text = "AAAAAAAAAAA"
             Case 2: oNode.Text = "BBBBBBBBBBB"
             Case 3: oNode.Text = "CCCCCCCCCCC"
             Case 4: oNode.Text = "DDDDDDDDDDD"
             Case 5:  oNode.Text = "EEEEEEEEEE"
           End Select
        Next lngIndex
      Case Else
        For lngIndex = 1 To 5
          Set oNode = ContentControl.XMLMapping.CustomXMLPart.SelectSingleNode(Replace(ContentControl.XMLMapping.XPath, "Master", "Slave" & lngIndex))
          oNode.Text = ChrW(8203)
        Next lngIndex
      End Select
  End If
lbl_Exit:
  Exit Sub
End Sub
Attached Files
File Type: docm change text.docm (58.9 KB, 24 views)
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find (highlight) two and more words in a list of 75k single words in Word 2010 Usora Word 8 05-29-2018 03:34 AM
Selection of a dropdown creates another dropdown wih the list krishnamurthy.ka2810 Word VBA 1 04-26-2018 11:44 PM
how to shows cells range depending on dropdown menu value mfran2002 Excel 5 10-26-2017 08:08 AM
Dropdown list - Words with spaces Challebjoern Excel Programming 0 05-23-2017 04:09 AM
Changing dropdown list colors in office 2010 forms Barry Bolton Word 1 02-19-2014 03:26 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:27 AM.


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