View Single Post
  #8   Report Post  
FredEp57
 
Posts: n/a
Default

Doug,

Again, thanks. I am trying to improve my skills and your tips have helped
immensely.

I would ask one more part. I have a table I built. Some of the cells have
textboxes and some have drop downs. How can I make a new row with the same
things in it?

Example, if I have a table with three cells and two have text and one has a
drop down with 5 choices. I need to make an exact copy of the upper row into
this new row. I can't figure out how to get the choices and drop down into
the table.

I can't find much on explaining the different keywords.

Again, Thanks much!!!
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