#1
|
|||
|
|||
Add Rows to table that will include content controls of previous rows
Is there a way to have someone add new rows to a table and have the new rows contain the content controls of the original row with mapping that is dependent on the cc's of that row only?
for example: If the document has one row that includes a State drop down list in one cell then a City and zip code plain text cc that is linked to the State drop down list in the one next 2 it and I then want to include another row that will mimic the mapping of the drop down list to the plain text, but be able to choose a new option from the drop down without affecting the other row. Hopefully the question is clear enough to understand. |
#2
|
|||
|
|||
Use a repeating section Content Control to engulf that row.
Mapping is a technical term. If you repeat a "mapped Content Control" the contents will be linked. By default, Content Controls inserted from the Developer Tab are not mapped. |
#3
|
||||
|
||||
This has been answered numerous times. See, for example:
Code to add new row in table Macro to add row to table in a Word form https://www.msofficeforums.com/word-...tml#post145675
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#4
|
|||
|
|||
|
#5
|
|||
|
|||
How would I add the code to my document?
|
#6
|
||||
|
||||
Which code? For: https://www.msofficeforums.com/87989-post3.html , simply copy the code from the post and paste it into your document's 'ThisDocument' code module. For https://www.msofficeforums.com/38461-post10.html and https://www.msofficeforums.com/145675-post4.html , simply open whichever of those documents' code you want to use and copy the code from its 'ThisDocument' code module and paste it into your document's 'ThisDocument' code module.
In each case, you can access the relevant document's 'ThisDocument' code module by pressing Alt-F11 and clicking on that document's 'ThisDocument' code module in the pane on the left side of the screen.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
Quote:
I just can't get a link together using my information for the life of me. Not sure where i'm going wrong. I can only link ccdrop down with cc plain text buy xml mapping, but I need to understand how to do it another way in order to insert it into my table so that when I want a new row to be added the content control selections will be independent of the previous and next rows. You've been a great help so far; appreciate it. |
#8
|
|||
|
|||
Here's the table i'm trying to complete. All I need to do is insert a drop down into the description cell to then auto-populate the code cell on exit. The other sections will have independent plain text fields. Then it a should allow them to add a new row if needed with the same options. Trying to make it as simple as possible for municipal inspectors.
|
#9
|
||||
|
||||
Given that you already need VBA for adding rows, I wouldn't take the approach in the link you posted. Instead, I'd do something along the lines of the attached.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#10
|
|||
|
|||
Thank you. We are certainly getting closer but, once I enter info then click on the last cell that prompts you to add a new row the "code" section erases. Seems to happen whenever the last cell is exited on any new row and erases all previous "code" fills.
|
#11
|
|||
|
|||
I mean you can go back and re-select the description in the drop down to repopulate the code section, so it's not too hard to just have people go back and redo that section. Thanks so much!
|
#12
|
||||
|
||||
Code revised. Try it now.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#13
|
|||
|
|||
Paul,
I've downloaded your file and here with both Word 2010 and 2016, the CC Exit event is firing twice. I've seen that before and at one point ensuring that the HOME tab wasn't the active Tab would cure it but not anymore. Are you seeing that behavior? |
#14
|
||||
|
||||
For some reason I haven't been able to get to the bottom of, that's happening if you click on another content control after exiting the last one on the row and choose 'No' for the response. It doesn't happen if you click anywhere else in the document or if you choose 'Yes' for the response.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#15
|
|||
|
|||
Paul, it looks like this line might be the culprit:
'If CCtrl.Range.Information(wdWithInTable) = False Then Exit Sub |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Delete rows with content controls | baes10 | Word VBA | 2 | 12-13-2017 10:12 AM |
Include multiple (but varying in number) Excel rows in each separate email | mrjimi | Mail Merge | 3 | 12-10-2017 09:45 AM |
Duplicating one or more table rows or an entire table with content controls | kevinbradley57 | Word VBA | 10 | 08-17-2017 02:13 PM |
Content Controls - Add Table Rows | dgiromini | Word VBA | 1 | 04-11-2014 03:04 PM |
Grouping table rows to prevent individual rows from breaking across pages | dennist77 | Word | 1 | 10-29-2013 11:39 PM |