Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #121  
Old 05-20-2019, 09:32 AM
Jfisher88 Jfisher88 is offline Multiple entries in dropdown lists Mac OS X Multiple entries in dropdown lists Office 2019
Novice
 
Join Date: May 2019
Posts: 2
Jfisher88 is on a distinguished road
Default

Thanks, I have the developer tab opened but for some reason, I can't edit the contents to change their names. Any idea why this would be happening? To be honest I'm kind of a noob with Word and may not be looking in the right spot.
Reply With Quote
  #122  
Old 05-20-2019, 02:58 PM
macropod's Avatar
macropod macropod is offline Multiple entries in dropdown lists Windows 7 64bit Multiple entries in dropdown lists Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

If you click on the dropdown content control, you should then be able to click on 'Properties' to edit the items.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #123  
Old 10-28-2019, 01:52 PM
Q&A Q&A is offline Multiple entries in dropdown lists Windows 10 Multiple entries in dropdown lists Office 2010
Novice
 
Join Date: Aug 2019
Posts: 1
Q&A is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Given that the second cell doesn't even have any content controls, I can only guess at what you want.

Suppose the dropdown content control in the 1st cell is titled 'ClientA' and the dropdown content control in the 2nd cell is titled 'ClientB'. Suppose also the text content control in the 1st cell is titled 'ClientDetailsA' and the text content control in the 2nd cell is titled 'ClientDetailsB'. In that case, you could use a macro like:
Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Application.ScreenUpdating = False
Dim i As Long, StrDetails As String
With ContentControl
  If .Title = "ClientA" Then
    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
    With ActiveDocument.SelectContentControlsByTitle("ClientDetailsA")(1)
      .LockContents = False
      .Range.Text = StrDetails
      .LockContents = True
    End With
  ElseIf .Title = "ClientB" Then
    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
    With ActiveDocument.SelectContentControlsByTitle("ClientDetailsB")(1)
      .LockContents = False
      .Range.Text = StrDetails
      .LockContents = True
    End With
  End If
End With
Application.ScreenUpdating = True
End Sub
First, thank you. This thread has been very helpful. I used the quoted code in a form I'm working on which has multiple drop-down lists. Is there a way for the drop-down list to not print if I don't make a selection? For example, in the "Content Control Properties," under "Drop-Down List Properties," I have "Choose type" as my my first "Display Name" which makes it show up automatically in the drop-down list. What follows are a list of options which if selected automatically populates text in another part of the document. If I do not select one of those options and leave it as "Choose type" is there a way to make the drop-down list not print because I don't want it to show on the printed document? I want it to print as if there is no drop-down list if an option is not selected. Would I use a conditional statement? Do you have a suggestion of what I have to do to modify the code to make this work? Any other ideas?
Reply With Quote
  #124  
Old 10-30-2019, 08:42 PM
Carlg Carlg is offline Multiple entries in dropdown lists Windows 8 Multiple entries in dropdown lists Office 2007
Novice
 
Join Date: Oct 2019
Posts: 2
Carlg is on a distinguished road
Default

I am also not sure if this was already answered as this thread is from years ago and I am not that familiar with how this works, but I am trying to create a drop down where the values listed are different than the output values. So I would have “Number 1” as the displayed value and “New York” as the output answer, etc. I tried using several of the previous codes but I need “Number 1” to go away and all I will be left with is “New York” in the document, does this make sense?
Reply With Quote
  #125  
Old 10-30-2019, 10:56 PM
Guessed's Avatar
Guessed Guessed is offline Multiple entries in dropdown lists Windows 10 Multiple entries in dropdown lists Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

It can be done if you:
1. Set up the drop down CC with different values for Display Name and Value
2. Bind that CC to an XML Mapping element by using the XML Mapping Pane
3. Make a selection with the drop down

When you want to 'fix' the CCs to show the values, run the
4. Run a macro to convert the CC type to a Plain Text CC.
Code:
Sub ChangeCCType()
  Dim aCC As ContentControl
  For Each aCC In Selection.Range.ContentControls
    aCC.Type = wdContentControlText
  Next
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #126  
Old 10-31-2019, 06:38 AM
Carlg Carlg is offline Multiple entries in dropdown lists Windows 8 Multiple entries in dropdown lists Office 2007
Novice
 
Join Date: Oct 2019
Posts: 2
Carlg is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
It can be done if you:
1. Set up the drop down CC with different values for Display Name and Value
2. Bind that CC to an XML Mapping element by using the XML Mapping Pane
3. Make a selection with the drop down

When you want to 'fix' the CCs to show the values, run the
4. Run a macro to convert the CC type to a Plain Text CC.
Code:
Sub ChangeCCType()
  Dim aCC As ContentControl
  For Each aCC In Selection.Range.ContentControls
    aCC.Type = wdContentControlText
  Next
End Sub
I tried using this, but it did not work, it still comes up as the Display Name rather than the Value. Can you explain how I can bind the CC to an XML mapping element? I do not know how to do that.
Reply With Quote
  #127  
Old 10-31-2019, 07:34 PM
Guessed's Avatar
Guessed Guessed is offline Multiple entries in dropdown lists Windows 10 Multiple entries in dropdown lists Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

The attached doc shows how it can work.

The simplest way to get a linked CC is to insert a CC via Insert>Quick Parts>Document Property> and choose one. This will give you a plain text CC linked to that document property.

You can step up a level by going to Developer>XML Mapping Pane>{select a schema like core-properties}>right click on an element eg title and choose Insert Content Control>Combo Box.

If you want to really get serious, you should use the tools provided by Greg Maxey or Graham Mayor
Attached Files
File Type: docm Linked CC Example.docm (45.5 KB, 35 views)
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #128  
Old 11-12-2019, 10:11 AM
jmadsen jmadsen is offline Multiple entries in dropdown lists Windows 10 Multiple entries in dropdown lists Office 2016
Novice
 
Join Date: Nov 2019
Posts: 1
jmadsen is on a distinguished road
Default Does this work in the Header of Word?

Hello, I successful got this to work in my document. Thank you! However, I would like to have this work in the Header of Word. I keep getting an error message on this line of the VBA code. Is it possible?
ActiveDocument.ContentControls(2).Range.Text = StrDetails
Reply With Quote
  #129  
Old 11-12-2019, 03:10 PM
Guessed's Avatar
Guessed Guessed is offline Multiple entries in dropdown lists Windows 10 Multiple entries in dropdown lists Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

jmadsen

This thread now has 128 posts in it and has headed in many different directions. You will need to provide more information if you want help. Perhaps attach your doc and describe more fully what you want to happen.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #130  
Old 03-31-2020, 12:06 PM
chriscla chriscla is offline Multiple entries in dropdown lists Windows 10 Multiple entries in dropdown lists Office 2013
Novice
 
Join Date: Mar 2020
Posts: 18
chriscla is on a distinguished road
Default back to the beginning

I applied the solution that Paul worked out in post #2 and it works great for smaller texts with more than one line.


Is it also possible to have two or more paragraphs of multiple lines as an output in the ClientDetails content control? And if so, could anyone explain me how to achieve this?
I'm using this list box in an instruction report and sometimes there is more than one paragraph of fixed text in relation with the choice in the list box.


Thanks for any advice/solution.


Chris
Reply With Quote
  #131  
Old 03-31-2020, 04:25 PM
macropod's Avatar
macropod macropod is offline Multiple entries in dropdown lists Windows 7 64bit Multiple entries in dropdown lists Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Yes, it's possible simply by changing the Chr(11) reference to vbCr, but the amount of text that can be held in the values is quite small, plus no formatting is provided for. You might do better linking the choices to building blocks holding the desired content. Please start a new thread for that.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #132  
Old 03-31-2020, 08:56 PM
chriscla chriscla is offline Multiple entries in dropdown lists Windows 10 Multiple entries in dropdown lists Office 2013
Novice
 
Join Date: Mar 2020
Posts: 18
chriscla is on a distinguished road
Default

Thanks Paul. I'll start a new thread.
Reply With Quote
  #133  
Old 10-07-2020, 08:57 PM
tripster23 tripster23 is offline Multiple entries in dropdown lists Windows 10 Multiple entries in dropdown lists Office 2013
Novice
 
Join Date: Oct 2020
Posts: 1
tripster23 is on a distinguished road
Default

Hi,

Thank you for this code. In the Content Control Properties > Drop-Down List Properties, is it possible to input more text? The Value field cuts off my text after a certain character limit.
Reply With Quote
  #134  
Old 10-07-2020, 09:22 PM
macropod's Avatar
macropod macropod is offline Multiple entries in dropdown lists Windows 10 Multiple entries in dropdown lists Office 2010
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Yes, there's a limit to how much content you can store in a content control's value. For longer content, you can use custom document variables instead. For some code that does that, see: https://www.msofficeforums.com/word-...tml#post119230. The code in that post also gets the variable content from Excel, but that may or may not be relevant to your requirements. The important thing to not is how the document variables are used.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #135  
Old 05-22-2021, 11:46 AM
enci101 enci101 is offline Multiple entries in dropdown lists Windows 10 Multiple entries in dropdown lists Office 2019
Novice
 
Join Date: May 2021
Location: Frankfurt, Germany
Posts: 2
enci101 is on a distinguished road
Default Three dependent form fields

Hello,
I'm trying to create an invoice template. Is there a possibility to have 3 text fields filled out depending on whats chosen in a dropdown list? The problem is that the text for each field needs to be a different one. Everything is supposed to be in one line in a table that can be replicated using ContentControl.
E.g.:

Product Name (from dropdown list)
-> Product number
-> Additional info
-> Price

Thanks in advance

Enci
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple entries in dropdown lists Delete Multiple Entries dudeabides Office 1 07-04-2011 02:49 AM
Multiple task lists and multiple calendars kballing Outlook 0 01-18-2011 10:23 AM
Creating Multiple Contact Lists meltee78 Outlook 1 01-03-2011 09:45 PM
multiple calendar entries across a group halfhearted Outlook 0 10-11-2009 12:13 PM
Word Forms : Dropdown lists wferaera45 Word 0 04-06-2006 03:02 AM

Other Forums: Access Forums

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


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