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