Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
Mikki
 
Posts: n/a
Default automatically format table rows

I'm using Word 2003/SP2. I'm creating a table in which all the rows are
identical - the cells within each row are formatted with form fields (text
boxes, check boxes, etc) The table also has borders, page borders, and
shading. This table will be distributed to users to fill in the blanks.
My problem is that each user will need a different number of rows and I would
like the user to be able to automatically add new formatted rows (including
the form fields) when they tab through the last cell in the table. By
leaving the table unlocked I can get a new row added but I don't know how to
automatically include the form fields. Thanks for any help you can give me!
  #2   Report Post  
Posted to microsoft.public.word.tables
Doug Robbins - Word MVP
 
Posts: n/a
Default automatically format table rows

This will require modification for your particular case if you have things
other than text formfields:

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

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

"Mikki" wrote in message
...
I'm using Word 2003/SP2. I'm creating a table in which all the rows are
identical - the cells within each row are formatted with form fields (text
boxes, check boxes, etc) The table also has borders, page borders, and
shading. This table will be distributed to users to fill in the blanks.
My problem is that each user will need a different number of rows and I
would
like the user to be able to automatically add new formatted rows
(including
the form fields) when they tab through the last cell in the table. By
leaving the table unlocked I can get a new row added but I don't know how
to
automatically include the form fields. Thanks for any help you can give
me!



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adjusting Table format Word 2003 pablo Microsoft Word Help 1 March 2nd 06 10:33 AM
Top two rows to be heading rows, one keeps turning off [email protected] Tables 1 December 31st 05 03:51 PM
Q: Automatically adding form fields to new rows in table Richard J Tables 1 December 29th 05 03:10 PM
20x20 multiplication table Bob S Tables 2 December 24th 05 02:27 PM
How can I set a default table format? Portia Tables 4 April 29th 05 08:42 AM


All times are GMT +1. The time now is 11:37 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"