View Single Post
  #2   Report Post  
Doug Robbins
 
Posts: n/a
Default

Here's one way:

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.Table s(1).Rows.Count,
ActiveDocument.Tables(1).Columns.Count).Range.Form Fields(1).ExitMacro =
"addrow"

ActiveDocument.Tables(1).Cell(ActiveDocument.Table s(1).Rows.Count,
1).Range.FormFields(1).Select

ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True



End Sub

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
"KLSiegel" wrote in message
...
I have a form, with fields, for collecting input from users. In the middle
of
the form is a table, with two text fields and a column that has clickable
check boxes. The table has four "content" rows plus a heading. The users
inform me that they may need to add rows to this table, because for some
instances, they have more information to record.

So how do I set things up such that if they need/want to, they can add
rows,
without unprotecting the form (and thus disabling the checkboxes, which
they
like having)? I'm guessing I'll need to create a macro of some kind, and
make
that an Exit macro on the last field or cell in the table. Alternately,
possibly I could create a button of some kind.

Any helpful suggestions?