Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
Worsty Worsty is offline
external usenet poster
 
Posts: 3
Default add rows to Word table

Doug Robbins posted this in an earlier post but I'm getting an error
message:

Bad parameter on the following line:

..Cell(.Rows.Count, .Columns.Count).Range.FormFields(1).ExitMacro =
"addRow"

Can anyone help me out please. If I comment it out then it adds
another row but doesn't do the copy of the types of form fields.


' 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 Long, i As Long
Dim Response
Response = MsgBox("Do you need to add another row to the table?", _
vbYesNo + vbQuestion + vbDefaultButton2, "Add another Row")
If Response = vbYes Then ' User chose Yes.
With ActiveDocument
.Unprotect
With Selection.Tables(1)
.Rows.Add
rownum = .Rows.Count
For i = 1 To .Columns.Count
ActiveDocument.FormFields.Add Range:=.Cell(rownum,
i).Range, Type:=wdFieldFormTextInput
Next i
.Cell(.Rows.Count, .Columns.Count).Range.FormFields
(1).ExitMacro = "addRow"
.Cell(.Rows.Count, 1).Range.FormFields(1).Select
End With
.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End With
Else ' User chose No.
Exit Sub
End If
  #2   Report Post  
Posted to microsoft.public.word.tables
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default add rows to Word table

The code should all be on one line or be broken with a Visual Basic line
break which is a space then an underscore.

--
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, originally posted via msnews.microsoft.com
"Worsty" wrote in message
...
Doug Robbins posted this in an earlier post but I'm getting an error
message:

Bad parameter on the following line:

.Cell(.Rows.Count, .Columns.Count).Range.FormFields(1).ExitMacro =
"addRow"

Can anyone help me out please. If I comment it out then it adds
another row but doesn't do the copy of the types of form fields.


' 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 Long, i As Long
Dim Response
Response = MsgBox("Do you need to add another row to the table?", _
vbYesNo + vbQuestion + vbDefaultButton2, "Add another Row")
If Response = vbYes Then ' User chose Yes.
With ActiveDocument
.Unprotect
With Selection.Tables(1)
.Rows.Add
rownum = .Rows.Count
For i = 1 To .Columns.Count
ActiveDocument.FormFields.Add Range:=.Cell(rownum,
i).Range, Type:=wdFieldFormTextInput
Next i
.Cell(.Rows.Count, .Columns.Count).Range.FormFields
(1).ExitMacro = "addRow"
.Cell(.Rows.Count, 1).Range.FormFields(1).Select
End With
.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End With
Else ' User chose No.
Exit Sub
End If


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
Word 2007 keep rows together in table Richard Burke Microsoft Word Help 1 January 28th 08 10:33 PM
Maximum Rows in Word Table cjaaron Tables 1 July 26th 07 09:22 PM
How do I format rows in a table in Word? (i.e. $,%,etc) Mel. Schuster Tables 5 July 8th 05 12:33 AM
2002 Word Table Rows Sarah LeV Tables 3 January 28th 05 02:31 AM
How do I keep rows of a table together in Word? Feisty49 Tables 1 January 8th 05 08:56 PM


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