How to insert a table row with content control

A

Alan

I want to write a macro for Word 2007 that inserts a new table row
that matches the format of a particular row, including the Content
Control. I tried recording these actions, but the macro recorder did
not let me do any right-click actions. When not recording, I could
not always get the row contents in the correct placement (table has
several fields).

Could someone help me out with this? Thanks, Alan
 
D

Doug Robbins - Word MVP

If you have the row that is formatted, including the Content Control,
selected when you run a macro containing the following code, a new row
containing the Content Control will be added at the bottom of the table:

Dim NewRow As Row
Selection.Copy
With Selection.Tables(1)
Set NewRow = .rows.Add
NewRow.Range.Paste
.rows(.rows.Count).Delete
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
A

Alan

Doug,
Is there a way to determine which table of multiple tables
is selected? Thanks, Alan
 
A

Alan

Doug,
          Is there a way to determine which table of multiple tables
is selected?     Thanks, Alan

I see that Selection.Tables(1) means the first table in the selected
area.

Alan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top