A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

automatically format table rows



 
 
Thread Tools Display Modes
  #1  
Old March 15th, 2006, 07:01 PM posted to microsoft.public.word.tables
external usenet poster
 
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  
Old March 15th, 2006, 07:45 PM posted to microsoft.public.word.tables
external usenet poster
 
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!



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Q: Automatically adding form fields to new rows in table Richard J Tables 1 December 29th, 2005 03:10 PM
Toolbars, Drop-Down Menus Rick New Users 1 September 21st, 2005 11:17 AM
Update - If statement Dan @BCBS Running & Setting Up Queries 13 December 14th, 2004 06:02 PM
Manual line break spaces on TOC or Table of tables Eric Page Layout 9 October 29th, 2004 04:42 PM
Here's a shocker Mike Labosh General Discussion 2 October 26th, 2004 05:04 PM


All times are GMT +1. The time now is 07:05 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.