|
#1
|
|||
|
|||
Ok, so forget about what I said about linking another content control to the drop down list.
What I need to do now is add another drop down list that updates another content control in the same document. They need to be completely seperate from the previous combo dropdown/content control. The problem is that when I copy the drop down list and the content control from your example and paste it to the document where I already have pasted a dropdownlist/content control, and i try to test it, the screen switches to VBA and says 'compile error: can't find project or library'. Can anybody please help me out? |
#2
|
||||
|
||||
Post #9 in this thread already describes how you would go about adding more sets.
Although that post refers to identifying the target content controls by index number, a better way might be to reference them via their own titles, using code like: Code:
ActiveDocument.SelectContentControlsByTitle("ClientDetails").Item(1).Range.Text = StrDetails
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Hi Paul,
I'm new to the forum, but when copying across the macro and the content controls from your Word doc above, what elements of the Macro need to be amended so it works in my document? As I can only see a reference to "Client" but no reference to "Client Details" in the Macro. So unsure how to proceed. Many thanks. |
#4
|
||||
|
||||
Hi Wordz,
I've been away for 3 1/2 months, hence the delay in replying. The reason the macro doesn't refer to "Client Details" is that the "Client Details" content control is referred to by its relative position in the document (content control # 2) rather than by name.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
||||
|
||||
If there's something you need help with, post your queries here.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
|||
|
|||
I have been trying to find a way to duplicate the information in my content control box1 elsewhere in my document..
Last edited by maverick561145; 10-22-2015 at 02:28 PM. Reason: sounds better |
#7
|
||||
|
||||
You can locate the output content control in whatever Section of the document you'd like.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
I have got the dropdown lists all filled in and my document pretty much filled out. so in my code how do I word that?
|
#9
|
||||
|
||||
This has nothing to do with the code but with where you place the output content control.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#10
|
|||
|
|||
I still can't figure out how to get the information that is in the content control dropdown to transfer into another location. I can get the address of the customer to but not the customer name. what am I doing wrong.
|
#11
|
||||
|
||||
You hadn't previously said you wanted both the name and the address in another location. In that case, you will need to change the code. I see that you have now edited post #32 to say that, but that's not what you asked at the time...
Change: StrDetails = Replace(.DropdownListEntries(i).Value, "|", Chr(11)) to: StrDetails = .Range.Text & Chr(11) & Replace(.DropdownListEntries(i).Value, "|", Chr(11))
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#12
|
|||
|
|||
I appreciate your help. But I must still be doing something wrong. I have changed the code and now I am getting this.
Roundhouse Nurseries Roundhouse Nurseries Phone: 08 1111 1111 Fax: 08 2222 2222 Email: sales@roundhousenurseries.com.au But it is still not going into the second location that I need it to go into. Maybe its not possible or I am missing the whole concept, and that's a for sure possibility. I would like to pick a customer from my dropdown list on page one and have it insert into a section on page 2 without having to go and choose the customer from the dropdown list on page 2. Like I said earlier I can get the address to insert just fine on page 2 just not the name. is this something that is possible? |
#13
|
||||
|
||||
You need to be clear about what your requirements are.
First you asked about how to have the output appear somewhere other than where the dropdown was located, which I answered. Then you changed the question after the event to say you wanted to include the dropdown value included in the output at that other location also, which I have also answered. Now it seems you're saying you want to have the full details appear in multiple locations. Don't keep moving the goal posts. When you've decided what it is you want, post back with the details of what that is.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#14
|
|||
|
|||
OK. I have a document that I have a dropdown box for my customer on page one when I choose my customer the address pops up. There is another location on page 3 that I need the same customer name to pop up there. Like I said earlier I can get the correct address to appear on page 3. just not the name of the customer. Thank you .
|
#15
|
||||
|
||||
Try:
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 With ActiveDocument .SelectContentControlsByTitle("ClientAddress").Item(1).Range.Text = StrDetails If StrDetails <> " " Then StrDetails = _ .SelectContentControlsByTitle("Client").Item(1).Range.Text & Chr(11) & StrDetails .SelectContentControlsByTitle("ClientDetails").Item(1).Range.Text = StrDetails End With End If End With End Sub 1. The dropdown (and any other ordinary control requiring only the client name) is titled 'Client'; 2. Every content control requiring just the client address is titled 'ClientAddress'; and 3. Every content control requiring the client name & address is titled 'ClientDetails'. Where you have multiple copies of any of these content controls to update, just refer to each by its index #, remembering to update all those with 'ClientAddress' before updating any with 'ClientDetails'.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
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 |