How to save form fields

W

Will Goldring

Anyone know how to retrieve form fields from a word doc
that's been opened by visual basic? I want to grab them
when the doc is closed (preferably), then write them to
an Access database.
 
C

Cindy M -WordMVP-

Hi Will,
Anyone know how to retrieve form fields from a word doc
that's been opened by visual basic? I want to grab them
when the doc is closed (preferably), then write them to
an Access database.
No way to extract form field information from a closed Word
document; you'd have to open it. Or the user would have had
to save the document as "data only".

In the opened form document you extract the form field
result:
doc.FormFields(index).Result

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 
W

Will Goldring

Hi Cindy-
What I meant was how do I grab the field data UPON
closure of the document - not when the doc is already
closed. Also, how can I save the document as "data only"?
 
S

Suzanne S. Barnhill

"Save data only for forms" is a document option on the Save tab of Tools |
Options. Set this property on your forms template, and it will apply to all
documents based on it.
 
C

Cindy M -WordMVP-

Hi Will,
What I meant was how do I grab the field data UPON
closure of the document
If you have the choice of using a macro saved in the
document, or its template, then use a macro named FileClose
(will fire when the document is closed).

Otherwise, if you're automating this from outside of Word,
you'd need to link up to the Document_Close event on the
document object variable.

For more help you should really be in one of the word.vba
or possibly office.developer newsgroups. This is a group
for end-user questions (as you'd have noticed if you'd read
a few messages before posting).

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 

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