Sub NewRow()
Dim tbl As Table
Dim rw As Row
Dim cl As Cell
Dim ffld As FormField
ActiveDocument.Unprotect 'password
Set tbl = Selection.Tables(1)
'remove EntryMacro from current last cell
Set cl = Selection.Cells(1)
Set ffld = cl.Range.FormFields(1)
ffld.EntryMacro = ""
Set rw = tbl.Rows.Add
For Each cl In rw.Cells
ActiveDocument.FormFields.Add cl.Range, wdFieldFormTextInput
If cl.ColumnIndex = rw.Cells.Count Then
Set ffld = cl.Range.FormFields(1)
ffld.EntryMacro = "NewRow"
End If
Next cl
ActiveDocument.Protect wdAllowOnlyFormFields, True ' ,password
End Sub
|