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

Show us the final code.

--
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
...
Doug,

Thanks for this. However, now I get a very strange result.

I changed all the occurances per your instructions below. Now, however,
for
some reason I get a dropdown field ALONG with the text input field in my
form. Can you explain this?

Thanks
F

"Doug Robbins" wrote:

Replace

ActiveDocument.Tables(1)

with

Selection.Tables(1)

wherever the former occurs.

The lines of code a pretty self explanatory.

The only other thing that I would add is that the macro needs to be named
Sub AddRow(). That was omitted from the code as pasted.

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