Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
joel
 
Posts: n/a
Default Can Word automatically create a new row in a table after data entr

Hi all, I'm trying to create a form in Word.

Basically, I'd like to create a table that uses both text form fields and
drop down form fields. I'd like it so once you tab through the last entry
field in a row, a new row is automatically created which replicates the text
form and drop down form fields from the row above.

Also, can a row in a table be modified so that if a cell contains a certain
word, the whole row changes text color or is highlighted in some way?

Is this possible? Thanks in advance!
  #2   Report Post  
Posted to microsoft.public.word.tables
Jezebel
 
Posts: n/a
Default Can Word automatically create a new row in a table after data entr

Neither of these is possible without writing macros.



"joel" wrote in message
...
Hi all, I'm trying to create a form in Word.

Basically, I'd like to create a table that uses both text form fields and
drop down form fields. I'd like it so once you tab through the last entry
field in a row, a new row is automatically created which replicates the
text
form and drop down form fields from the row above.

Also, can a row in a table be modified so that if a cell contains a
certain
word, the whole row changes text color or is highlighted in some way?

Is this possible? Thanks in advance!



  #3   Report Post  
Posted to microsoft.public.word.tables
Doug Robbins - Word MVP
 
Posts: n/a
Default Can Word automatically create a new row in a table after data entr

This will need some modification, but it does part of what you want to do:

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

"joel" wrote in message
...
Hi all, I'm trying to create a form in Word.

Basically, I'd like to create a table that uses both text form fields and
drop down form fields. I'd like it so once you tab through the last entry
field in a row, a new row is automatically created which replicates the
text
form and drop down form fields from the row above.

Also, can a row in a table be modified so that if a cell contains a
certain
word, the whole row changes text color or is highlighted in some way?

Is this possible? Thanks in advance!



  #4   Report Post  
Posted to microsoft.public.word.tables
joel
 
Posts: n/a
Default Can Word automatically create a new row in a table after data

Doug - First off, thank you very much for your help. I added the 'addrow'
macro to the Text Form Field Options of the last field in the row, and it
does indeed automatically create a new row with new text fields. It doesn't,
however, reproduce the drop-down field menu. Is there a way to do that as
well?

For example: The row has 5 columns, and 3 of those would be text fields and
two would be drop down fields. Can those drop-downs be reproduced
automatically in the new row?

(I should point out that I'm very ignorant of macros, so as lay as is gets
in layman's terms would be appropriate here)

Thanks again!
  #5   Report Post  
Posted to microsoft.public.word.tables
Doug Robbins - Word MVP
 
Posts: n/a
Default Can Word automatically create a new row in a table after data

The following code will add Text FormFields to the first 3 cells and
DropDown FormFields to the cells 4 and 5. You will need to replace the
Item1 through Item5 and ItemA through ItemB with the actual items that you
want in the dropdowns:

Dim rownum As Integer, i As Integer
With ActiveDocument
.Unprotect
.Tables(1).Rows.Add
rownum = .Tables(1).Rows.Count
For i = 1 To 3
.FormFields.Add Range:=.Tables(1).Cell(rownum, i).Range,
Type:=wdFieldFormTextInput
Next i
.FormFields.Add Range:=.Tables(1).Cell(rownum, 4).Range,
Type:=wdFieldFormDropDown
With .Tables(1).Cell(rownum, 4).Range.FormFields(1).DropDown.ListEntries
.Add "Item1"
.Add "Item2"
.Add "Item3"
.Add "Item4"
.Add "Item5"
End With
.FormFields.Add Range:=.Tables(1).Cell(rownum, 5).Range,
Type:=wdFieldFormDropDown
With .Tables(1).Cell(rownum, 5).Range.FormFields(1).DropDown.ListEntries
.Add "ItemA"
.Add "ItemB"
.Add "ItemC"
.Add "ItemD"
.Add "ItemE"
End With
.Tables(1).Cell(rownum, 5).Range.FormFields(1).ExitMacro = "addrow"
.Tables(1).Cell(rownum, 1).Range.FormFields(1).Select
.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End With


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

"joel" wrote in message
...
Doug - First off, thank you very much for your help. I added the
'addrow'
macro to the Text Form Field Options of the last field in the row, and it
does indeed automatically create a new row with new text fields. It
doesn't,
however, reproduce the drop-down field menu. Is there a way to do that as
well?

For example: The row has 5 columns, and 3 of those would be text fields
and
two would be drop down fields. Can those drop-downs be reproduced
automatically in the new row?

(I should point out that I'm very ignorant of macros, so as lay as is gets
in layman's terms would be appropriate here)

Thanks again!





  #6   Report Post  
Posted to microsoft.public.word.tables
joel
 
Posts: n/a
Default Can Word automatically create a new row in a table after data



"Doug Robbins - Word MVP" wrote:
Hope this helps.



It sure does, Doug. Thanks again for your help.
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
How do I set right and left alignment on the same line in Word? Matador Page Layout 1 November 9th 05 08:32 PM
how do i set up template in vbeditor without proggramming language ARRRGH New Users 4 October 1st 05 03:19 AM
Envelope Address GR New Users 5 April 24th 05 09:48 PM
In Word, how can I see all files (*.*) in "save as"? citizen53 New Users 8 April 4th 05 04:56 PM
Table headers Sam Hobbs New Users 12 December 20th 04 07:18 PM


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