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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top