Forum Discussion
Restricted editing in Word Fillable form
Techsolver Assuming that you are using a version of Office that supports the use of Content Controls, if you select the row that you want to repeat and then insert a Repeating Section Content Control
For more on the use of Content Controls, see the following and other pages of Greg Maxey's website:
https://gregmaxey.com/word_tip_pages/content_controls.html
If for some reason you do not want to use Content Controls, you could have a macro, similar to the following, set to be run on exit from the last formfield in the row that you want to be repeated. Note, the macro will need to be modified to suit the FormFields that you are using in that row.
Sub Addrow()
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
- TechsolverMar 11, 2023Copper Contributor
Doug_Robbins_Word_MVP It adds just a single row without the margins but I want it should be added just like the table below. There are more tables in the main document. I want it for most of them but not for all of them.
- Mar 11, 2023
Techsolver Can you provide a copy of the document so that we can see what you have in it.