![]() |
|
#1
|
|||
|
|||
![]()
Hi
Can i create a Template with dropdown list of 35 companies to choose from using the following examples to show what i require: If i select Roundhouse Nurseries or Smithswholesales from the list it also includes Phone Number,Fax Number and Email address for each company....can i have about 35 companies in the dropdown list to choose from....i will only select 1 company at a time as this will be for a invoice (will create a template)....i want it to show the email address but not have the blue underline Roundhouse Nurseries Phone: 08 1111 1111 Fax: 08 2222 2222 Email: sales@roundhousenurseries.com.au Smiths Wholesales Phone: 08 3333 3333 Fax: 08 4444 4444 Email: sales@smithswholesales.com.au Thanks Paul Excel 2010 |
#2
|
||||
|
||||
![]()
You could add the entries to a dropdown content control. As the dropdown only supports a single line per entry, the other data could be output to a plain text or rich text content control via an on_exit macro (i.e. you must exit the dropdown content control after updating it for the conditional output to appear). See attached demo. If you examine the dropdown, you'll see the Client names appear. And, if you examine the dropdown's properties, you'll see that for each client name, the 'Value' field contains the dependent data, with the different output lines separated by | characters, as in:
Phone: 08 1111 1111|Fax: 08 2222 2222|Email: sales@roundhousenurseries.com.au The code is: Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean) Dim i As Long, StrDetails As String With ContentControl If .Title = "Client" 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 ActiveDocument.ContentControls(2).Range.Text = StrDetails End If End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
That looks interesting...i could maybe used this for my needs
Rich |
#4
|
|||
|
|||
![]()
Hi Paul
Looks excellent...i will have a play around later but so far looks great.. Is there a limit on how many entries i can place in the Content Control Dropdown box If i want to add other lists further down the page such as personal information will i just use the code you supplied or will a further code update be required Example: Names: xxxxxxxxxxxx Credit Card No: xxxxxxxxx Card type: xxxxxxxxxx Expiry date: xxxxxxxxxx Thanks Paul |
#5
|
||||
|
||||
![]() Quote:
You won't need to make any code changes. Simply add your entries with the names as the content control display name and the other details with pipe separators (ie |) for each line as the content control value. It doesn't even matter if the number of lines vary from one client to the next.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
|||
|
|||
![]()
Hi Paul
Thank you I think i will have 50 If you have time could you please attach a sample of the "other details with pipe separators (ie |) for each line as the content control value. It doesn't even matter if the number of lines vary from one client to the next" Would be appreciated Paul |
#7
|
|||
|
|||
![]() Quote:
Thanks! Last edited by Dludwikowski; 03-12-2014 at 09:55 AM. |
#8
|
|||
|
|||
![]()
Would you be willing to discuss this in more detail with me? Your template is great, just not sure how to edit it to work with my stuff. Thanks so much!
Last edited by macropod; 08-24-2015 at 04:26 PM. Reason: Email address removed for privacy |
#9
|
|||
|
|||
![]() Quote:
Ive attempted to utilize your demo and am having an issue with a new drop down box being added to the doc... i have a dropdown cc named "Type" with a few choices within. I copied and pasted the dropdown cc onto the second page. What happens is, my macro runs, the value changes per the macro; however, the first dropdon cc is not changed, the second is changed and a third dropdown cc magically appears. Perhaps you can assist me with solving my issues? Please let me know. Many thanks |
#10
|
|||
|
|||
![]() Quote:
We have a form where we want the following: If "To be processed" is selected in the dropdown list it should on a line below give information "We are including X amount of attachments" where X need to be a textbox. Since this all is in a form. Is this possible? Many thanks Tanja Last edited by tostrand; 07-12-2018 at 08:07 AM. Reason: Enter my name |
#11
|
|||
|
|||
![]()
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. |
#12
|
|||
|
|||
![]()
Hi,
I am new to Macros.. I was able to change the drop down items to and its result. But I would like to change the First Content Control titles from "Client Details" to "Please Select" and the second Content Control Title from "Client" to "Blank" I have tried to change in the properties and in the code too but it gives me Run Time Error "6189" Also I would like to result to be in other place not close to drop down menu. Is it possible. Thanks |
#13
|
||||
|
||||
![]() Quote:
Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#14
|
|||
|
|||
![]() Quote:
Last edited by bil_san1; 10-12-2022 at 02:55 AM. Reason: Found the answer in another post |
#15
|
||||
|
||||
![]()
Yes, that's quite possible. You could, for example, keep adding If ... End If tests to the code for each of the additional content controls. As for the output, you need to make sure the 2 in 'ActiveDocument.ContentControls(2).Range.Text' refers to the correct content control in each case (e.g. you might need to change it to 4 for the second one, and so on).
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
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 |