Reply
 
Thread Tools Display Modes
  #1   Report Post  
FredEp57
 
Posts: n/a
Default Forms and tables

I would like to have a form with a table in it. However, I am not sure how
many rows the table will need.

Is the some trick to having a table dynamically add to itself (with the form
field of the above row)?

Thanks
F
  #2   Report Post  
Doug Robbins
 
Posts: n/a
Default

Have the following macro run on exit from the last formfield in the table:

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
"FredEp57" wrote in message
...
I would like to have a form with a table in it. However, I am not sure how
many rows the table will need.

Is the some trick to having a table dynamically add to itself (with the
form
field of the above row)?

Thanks
F



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
Automated forms JT Microsoft Word Help 1 June 16th 05 05:56 PM
printing empty text fields on word forms moombi Microsoft Word Help 1 June 10th 05 08:16 AM
Word Forms Kristy Microsoft Word Help 1 April 29th 05 05:45 PM
Caption numbering problem in TOC Gillman Formatting Long Documents 1 March 17th 05 10:49 AM
Lines in forms to type on Kim K Microsoft Word Help 1 February 28th 05 06:04 PM


All times are GMT +1. The time now is 03:13 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"