Inserting text into a form field using automation

A

Andy Richardson

I created a word document from a template that has some text and some form
fields, and I have the document protected except for the form fields. I
would like to insert text into these form fields using automation. Anybody
know how? I am obviously getting a runtime error saying the document is
protected, but I should be able to edit the form fields.
 
C

Chad DeMeyer

Andy,
You don't specify your development platform, but if using Word VBA:

Dim oFF As FormField
'Assign oFF to a formfield in the document
oFF.Result = "My text to insert"

Regards,
Chad
 
C

Chad DeMeyer

Andy,

In order to manipulate objects specific to Word, such as a formfield in a
document, you'll need a reference specifically to the Word object library.
Then, you should be able to extrapolate from the code I provided how to
write the code for that part of the object model using C#.

Regards,
Chad
 
A

Andy Richardson

I can't figure out how to assign the FormField variable to a form field in
the document.

Thanks for all your help Chad,
Andy


Chad DeMeyer said:
Andy,

In order to manipulate objects specific to Word, such as a formfield in a
document, you'll need a reference specifically to the Word object library.
Then, you should be able to extrapolate from the code I provided how to
write the code for that part of the object model using C#.

Regards,
Chad


Andy Richardson said:
I'm using C# using the Microsoft Office Object Library as my reference.


Chad DeMeyer said:
Andy,
You don't specify your development platform, but if using Word VBA:

Dim oFF As FormField
'Assign oFF to a formfield in the document
oFF.Result = "My text to insert"

Regards,
Chad


"Andy Richardson" <andy.richardson[at]gimmal.com> wrote in message

I created a word document from a template that has some text and
some
form
fields, and I have the document protected except for the form
fields.
document
 

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