Doug,
FInally got this to "work". However, I have a couple of problems.
1 - can you explain each line (what it does and/or is doing) please?
2 - I have a lot of different tables so need to access the first and third.
Changing (globally) from (1) to (3) for the third causes an error.
3 - when I use the code on exit, the next row does not add any fields. Am I
missing something?
Thanks again for you invaluable help.
F
"Doug Robbins" wrote:
' 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
--
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
"FredEp57" wrote in message
...
Not sure if the first one got through so I am asking again.
I want to have a table in my form. The table has text fields in each
cell.
I need to have the table grow dynamically and have the text field in each
new
row/cell.
Can this be done? Or am I approaching this the wrong way?
Thanks
F
|