Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting Form Field Text

Status
Not open for further replies.

bigmerf

MIS
Oct 4, 2002
247
US
I have a Word template form where users tab through and enter text into specific fields. The form is locked and the tab sequence is setup for easy entry into the form.

Now, what I would like to do is have a default word or line of text on one of the fields and have the default text delete as soon as the user tabs to the field.

Entering the default text is easy (double-click on the form field and enter default text). But how would I delete the text when the user tabs to that specific field?

Is there a way to add VB code to an OnSelect event or soemthing like that? I've written VB code in Excel and Access, but Word seems to be a bit different or at least I'm not having an easy time recording macros and trying to formulate some code.

Thanks!
 
Hi WLT,

You'd need to attach an 'On Entry' macro to the formfield. The 'On Entry' sub might be coded as:
Sub Text1OnEntry()
ActiveDocument.FormFields("Text1").Result = ""
End Sub
where 'Text1' is the formfield's bookmark name.

However, it may be better to simply add some help text to the formfield.

Cheers

[MS MVP - Word]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top