S
skbenlc
Need assistance:
I'm working with a basic table generated using 2003 ms word forms.
Each cell of the table has a text form fill cell - table has one row,
and five cols.
The document has been saved as a template with the following macro
entered into the last cell.
Protection enabled.
Intent is for the last cell to be used to prompt the user on exit if
an additional row is needed.
If yes - another row is added - if not then allowed to move on to the
next section of the form which is unprotected.
I found this macro -- labled to add a table row using word forms.
I get the following error message: "Compile Error - Sub or Function
not defined"
Do I need to book mark the first cell in the table?
The macro is named as Macro6 and set for exit -- bookmark is filled in
as text5
Sub Macro6()
' 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
End Sub
I'm working with a basic table generated using 2003 ms word forms.
Each cell of the table has a text form fill cell - table has one row,
and five cols.
The document has been saved as a template with the following macro
entered into the last cell.
Protection enabled.
Intent is for the last cell to be used to prompt the user on exit if
an additional row is needed.
If yes - another row is added - if not then allowed to move on to the
next section of the form which is unprotected.
I found this macro -- labled to add a table row using word forms.
I get the following error message: "Compile Error - Sub or Function
not defined"
Do I need to book mark the first cell in the table?
The macro is named as Macro6 and set for exit -- bookmark is filled in
as text5
Sub Macro6()
' 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
End Sub