Problem formfields in table

J

jbc

Hello,

I'm working with a form that is made up of several tables. The table has
several formfields. The user goes thru them and is prompted to add another
item. The macro adds a new row and creates new formfields. See code below:

The problem that I'm having is when I go to type in the first newly created
formfield. Word is not accepting the first character. What am I doing
wrong? I've played around with different ways of selecting the cell and am
at a loss.

Thanks.

jbc

Sub AddNew1()

Dim ff As FormField
Dim intResponse As Integer

intResponse = MsgBox("Add Another Option?", vbYesNo, "Please Make a
Selection")

If intResponse = vbYes Then

ActiveDocument.Unprotect

'Remove Exit Macro From Last Cell in Row
Selection.GoTo what:=wdGoToBookmark, Name:="LastFormField1"

With Selection.FormFields(1)
.ExitMacro = ""
End With


Selection.Tables(1).Rows.Add
Selection.MoveRight Unit:=wdCell, Count:=4

'Document Number
Set ff = ActiveDocument.FormFields.Add _
(Range:=Selection.Range, Type:=wdFieldFormTextInput)

With ff
.Name = "TypeHere1"
.OwnStatus = True
.StatusText = "Type Document Number"
End With

Selection.MoveRight Unit:=wdCell

Set ff = ActiveDocument.FormFields.Add _
(Range:=Selection.Range, Type:=wdFieldFormTextInput)

With ff
.OwnStatus = True
.StatusText = "Type Code"
End With

Selection.MoveRight Unit:=wdCell

Set ff = ActiveDocument.FormFields.Add _
(Range:=Selection.Range, Type:=wdFieldFormTextInput)

With ff
.OwnStatus = True
.StatusText = "Type Name"
End With


Selection.MoveRight Unit:=wdCell

Set ff = ActiveDocument.FormFields.Add _
(Range:=Selection.Range, Type:=wdFieldFormTextInput)

With ff
.OwnStatus = True
.StatusText = _
"Type Date, If No Date, Type 'Issued' Date, xx/xx/xx"
.TextInput.EditType Type:=wdDateText, Format:="MM-dd-YYYY"
End With


Selection.MoveRight Unit:=wdCell

Set ff = ActiveDocument.FormFields.Add _
(Range:=Selection.Range, Type:=wdFieldFormTextInput)

With ff
.Name = "LastFormField1"
.ExitMacro = "AddNew1"
.OwnStatus = True
.StatusText = "Type Requested Information"
End With

ActiveDocument.Bookmarks("TypeHere1").Range.Fields(1).Result.Select
ActiveDocument.Protect wdAllowOnlyFormFields, noReset:=True

End If
 

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