Macro in MS Word to clear text fields

T

tccrep

Hi there,

I'm trying to create a macro that will clear text fields within a word
document, and i'm having no such luck.

I've created an identical version in excel which works well, but need one for
word too.

Can anyone help?

Thanks,
 
C

Charles Kenyon

If you are using what Word calls an online form simply protecting and
unprotecting the form will reset all form fields.
ActiveDocument.unprotect
ActiveDocument.Protect Type:=wdAllowOnlyFormFields

For more about online forms, follow the links at
http://addbalance.com/word/wordwebresources.htm#Forms or
http://word.mvps.org/FAQs/Customization/FillinTheBlanks.htm especially Dian
Chapman's series of articles. You may also want to look at
http://www.word.mvps.org/FAQs/TblsFldsFms/LinesInForms.htm.

Hope this helps,
--

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
T

tccrep

Thanks for the info, but I think I forgot to mention one important part.

I want to include a command button that when clicked will clear the various
fields.

Can this be done?

Thanks,

Charles said:
If you are using what Word calls an online form simply protecting and
unprotecting the form will reset all form fields.
ActiveDocument.unprotect
ActiveDocument.Protect Type:=wdAllowOnlyFormFields

For more about online forms, follow the links at
http://addbalance.com/word/wordwebresources.htm#Forms or
http://word.mvps.org/FAQs/Customization/FillinTheBlanks.htm especially Dian
Chapman's series of articles. You may also want to look at
http://www.word.mvps.org/FAQs/TblsFldsFms/LinesInForms.htm.

Hope this helps,
Hi there,
[quoted text clipped - 8 lines]
 

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