Dynamically creating rows

B

bell282

Not sure if this is the right board to post on or not - so i apologiz
in advance if it is.

I am not sure that what i want to be able to do is possible, I have
form that i want to add a table to - but i want the user to have a
many rows as necesary with out me putting in the max number of rows.
But when i lock the file - the table is locked as well. Is there an
way around this?

Thanks,
-bel
 
G

Graham Mayor

You could put a continuous section break either side of the table and leave
the table section unprotected.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
Graham Mayor - Word MVP
E-mail (e-mail address removed)
Web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

If the table is a part of the form in that it contains formfields, if you
set the following macro to run on exit from the last cell in the last row of
the table, a new row will be added when the user exits that formfield. This
process will repeat on exit from the last cell in the newly added 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

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
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