Form Field w/in table

J

jbc

I need to create code that finds the last table in a document and adds two
form fields to the table. The cells are row 4, col 2 and row 6, col 2.

Thanks.

jbc
 
D

Doug Robbins - Word MVP

Dim i As Long, protype As Boolean

With ActiveDocument
protype = False
If .ProtectionType = wdAllowOnlyFormFields Then
.Unprotect
protype = True
End If
i = .Tables.Count
.FormFields.Add Range:=.Tables(i).Cell(4, 2).Range,
Type:=wdFieldFormTextInput
.FormFields.Add Range:=.Tables(i).Cell(6, 2).Range,
Type:=wdFieldFormTextInput
If protype = True Then
.Protect wdAllowOnlyFormFields, NoReset
End If
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
 
Top