Need to copy row of a protected table

K

Ken

I have a form that is sent to users within our corporation. The form is
protected so that users can only enter their responses into text fields
within the form -- they're not able to modify or alter the questions. I
need a way for the user to generate a new row if they have multiple
situations for which they need to respond for a given question..

I created a button which turns the protection off, copies the current row
the user is answering, creates a new row, pastes the copied row, and turns
back on the protection. Problem is that it also copies the text when pasting
-- I'm looking for a way to copy only the protected text, not the user text.
I tried the ResetFormFields command, but that only seems to work for the
whole document, not just the row that was copied.

Any suggestions?
 
D

Doug Robbins - Word MVP

If this macro is set to be run on exit from the last formfield in the row,
it will add a new row containing a formfield in each cell in that row.

Sub addrow()
'
' Macro created 02/02/03 by Doug Robbins
' To add a new row to a table containing formfields in every column
' automatically on exit from the last cell in the present last row of the
table
Dim rownum As Integer, i As Integer
ActiveDocument.Unprotect
ActiveDocument.Tables(1).Rows.Add
rownum = ActiveDocument.Tables(1).Rows.Count
For i = 1 To ActiveDocument.Tables(1).Columns.Count
ActiveDocument.FormFields.Add
Range:=ActiveDocument.Tables(1).Cell(rownum, i).Range,
Type:=wdFieldFormTextInput
Next i
ActiveDocument.Tables(1).Cell(ActiveDocument.Tables(1).Rows.Count,
ActiveDocument.Tables(1).Columns.Count).Range.FormFields(1).ExitMacro =
"addrow"
ActiveDocument.Tables(1).Cell(ActiveDocument.Tables(1).Rows.Count,
1).Range.FormFields(1).Select
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True

End Sub

--
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
 

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