|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Auto populate text box based on drop-down content control and repeat the process via copy paste
Hi
I am trying to create one template for reporting. I want to create a word document where I can have several comments. What I would like to do is, create an drop-down content control and based on the choice I want to populate one text box. I can do it for one set of operation. I would now like to copy paste the set (drop-down + text box) elsewhere in the document and want to have the same functionality available. This process I want to do multiple times. Can you please help me out. I have attached the part I was able to do. 1st set it is working based on the VBA code behind. 2nd set I have just copy pasted. Obviously it is not working. But how do I make it work? The part of the code that I have manged is available in the forum though. Thanks in advance |
#2
|
|||
|
|||
Well it just doesn't work that way. There is nothing that associates a pair of copied CCs.
If you are pasting them to rows as show in your example then perhaps you could use: Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean) Dim i As Long, StrDetails As String With ContentControl If .Title = "Action" 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 ContentControl.Range.Cells(1).Next.Range.ContentControls(1).Range.Text = StrDetails End If End With End Sub |
#3
|
|||
|
|||
Well, I don't know how to thank you. This is exactly what I wanted. Thank you very much. It is working great.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
VBA to provide text string with specific formating based on Drop down list (content control) | MP1989 | Word VBA | 4 | 07-30-2018 02:40 AM |
Content Controls (Drop Down copy and paste), and XML mapping | dezdelaina | Word | 3 | 03-05-2018 06:50 PM |
auto populate multiple text boxes dependent on a drop down | angelaschultz | Word VBA | 7 | 03-18-2017 03:00 PM |
Auto Populate Text On Dependent Drop Down Exit | GregStewartPTC | Word VBA | 2 | 02-27-2017 05:37 AM |
Populate Drop-Down Content Control from CustomXMLPart added to the Document | KhmerBoi1 | Word VBA | 0 | 05-11-2016 01:10 PM |