Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-17-2020, 09:41 AM
bobsagat bobsagat is offline Add Rows to table that will include content controls of previous rows Windows 8 Add Rows to table that will include content controls of previous rows Office 2016
Novice
Add Rows to table that will include content controls of previous rows
 
Join Date: Jan 2020
Posts: 12
bobsagat is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 01-17-2020, 03:37 PM
Charles Kenyon Charles Kenyon is offline Add Rows to table that will include content controls of previous rows Windows 10 Add Rows to table that will include content controls of previous rows Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 6,402
Charles Kenyon is a name known to allCharles Kenyon is a name known to allCharles Kenyon is a name known to allCharles Kenyon is a name known to allCharles Kenyon is a name known to allCharles Kenyon is a name known to all
Default

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.
Reply With Quote
  #3  
Old 01-18-2020, 12:28 AM
macropod's Avatar
macropod macropod is offline Add Rows to table that will include content controls of previous rows Windows 7 64bit Add Rows to table that will include content controls of previous rows Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 20,064
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

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
[MS MVP - Word]
Reply With Quote
  #4  
Old 01-18-2020, 08:05 AM
gmaxey gmaxey is offline Add Rows to table that will include content controls of previous rows Windows 10 Add Rows to table that will include content controls of previous rows Office 2016
Word MVP 2003-2009
 
Join Date: May 2010
Location: Marble, NC
Posts: 1,009
gmaxey will become famous soon enoughgmaxey will become famous soon enough
Default

Add Table Row/Column With Content
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #5  
Old 01-21-2020, 08:25 AM
bobsagat bobsagat is offline Add Rows to table that will include content controls of previous rows Windows 8 Add Rows to table that will include content controls of previous rows Office 2016
Novice
Add Rows to table that will include content controls of previous rows
 
Join Date: Jan 2020
Posts: 12
bobsagat is on a distinguished road
Default

How would I add the code to my document?
Reply With Quote
  #6  
Old 01-21-2020, 01:14 PM
macropod's Avatar
macropod macropod is offline Add Rows to table that will include content controls of previous rows Windows 7 64bit Add Rows to table that will include content controls of previous rows Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 20,064
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

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
[MS MVP - Word]
Reply With Quote
  #7  
Old 01-23-2020, 09:00 AM
bobsagat bobsagat is offline Add Rows to table that will include content controls of previous rows Windows 8 Add Rows to table that will include content controls of previous rows Office 2016
Novice
Add Rows to table that will include content controls of previous rows
 
Join Date: Jan 2020
Posts: 12
bobsagat is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
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.
I got this to work, but i'm still having trouble with this part of the document from this thread https://www.msofficeforums.com/word/...e-ccplain.html .
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.
Reply With Quote
  #8  
Old 01-23-2020, 09:20 AM
bobsagat bobsagat is offline Add Rows to table that will include content controls of previous rows Windows 8 Add Rows to table that will include content controls of previous rows Office 2016
Novice
Add Rows to table that will include content controls of previous rows
 
Join Date: Jan 2020
Posts: 12
bobsagat is on a distinguished road
Default

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.
Attached Images
File Type: png blight table.png (3.1 KB, 19 views)
Reply With Quote
  #9  
Old 01-23-2020, 04:27 PM
macropod's Avatar
macropod macropod is offline Add Rows to table that will include content controls of previous rows Windows 7 64bit Add Rows to table that will include content controls of previous rows Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 20,064
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

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.
Attached Files
File Type: docm Inspection Form.docm (45.8 KB, 4 views)
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #10  
Old 01-24-2020, 07:18 AM
bobsagat bobsagat is offline Add Rows to table that will include content controls of previous rows Windows 8 Add Rows to table that will include content controls of previous rows Office 2016
Novice
Add Rows to table that will include content controls of previous rows
 
Join Date: Jan 2020
Posts: 12
bobsagat is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
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.
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.
Reply With Quote
  #11  
Old 01-24-2020, 07:29 AM
bobsagat bobsagat is offline Add Rows to table that will include content controls of previous rows Windows 8 Add Rows to table that will include content controls of previous rows Office 2016
Novice
Add Rows to table that will include content controls of previous rows
 
Join Date: Jan 2020
Posts: 12
bobsagat is on a distinguished road
Default

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!
Reply With Quote
  #12  
Old 01-24-2020, 02:23 PM
macropod's Avatar
macropod macropod is offline Add Rows to table that will include content controls of previous rows Windows 7 64bit Add Rows to table that will include content controls of previous rows Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 20,064
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

Code revised. Try it now.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #13  
Old 01-24-2020, 05:29 PM
gmaxey gmaxey is offline Add Rows to table that will include content controls of previous rows Windows 10 Add Rows to table that will include content controls of previous rows Office 2016
Word MVP 2003-2009
 
Join Date: May 2010
Location: Marble, NC
Posts: 1,009
gmaxey will become famous soon enoughgmaxey will become famous soon enough
Default

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?
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #14  
Old 01-24-2020, 07:16 PM
macropod's Avatar
macropod macropod is offline Add Rows to table that will include content controls of previous rows Windows 7 64bit Add Rows to table that will include content controls of previous rows Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 20,064
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

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
[MS MVP - Word]
Reply With Quote
  #15  
Old 01-25-2020, 09:41 AM
gmaxey gmaxey is offline Add Rows to table that will include content controls of previous rows Windows 10 Add Rows to table that will include content controls of previous rows Office 2016
Word MVP 2003-2009
 
Join Date: May 2010
Location: Marble, NC
Posts: 1,009
gmaxey will become famous soon enoughgmaxey will become famous soon enough
Default

Paul, it looks like this line might be the culprit:
'If CCtrl.Range.Information(wdWithInTable) = False Then Exit Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add Rows to table that will include content controls of previous rows Delete rows with content controls baes10 Word VBA 2 12-13-2017 10:12 AM
Add Rows to table that will include content controls of previous rows Include multiple (but varying in number) Excel rows in each separate email mrjimi Mail Merge 3 12-10-2017 09:45 AM
Add Rows to table that will include content controls of previous rows 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
Add Rows to table that will include content controls of previous rows Grouping table rows to prevent individual rows from breaking across pages dennist77 Word 1 10-29-2013 11:39 PM


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


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