Create field name in MS Word document

Dear all,

I would like to ask how to create field name in MS Word document so that we can transfer the field value from notes document to MS Word using this method

objWord.ActiveDocument.FormFields(“Name”).Result = doc.Fname(0)

From the MS Word help, I can see it only allow us to give the field name which are listed in the categories but not user definable field name.

Can anyone please help, thanks.

Subject: Create field name in MS Word document

Hi Ching,

Try the following code

value= doc.getitemvalue(“myField”)(0)

targetFormFieldname = “FormField1”

’ Formfield update

Set field = objWord.ActiveDocument.Formfields(targetFormFieldname)

If (Isobject(field)) Then

’ We have the formfield

If fillInFormFieldBln Then

	' Fill in field

	If (Len(value)>255) Then value=Left$(value, 255)

	field.result=value

Else

	' Replace field with value

	Set range=field.range

	Call range.collapse(wdCollapseEnd)

	Call range.insertAfter(value)

	Call field.range.delete()

End If

End If