Lock language in FORMTEXT

J

John Morris

Hello,

My client is an non-profit internation medical research company doing
business in English only. Investigators are required to complete Word
2003 forms which include a date in a text form field. When the forms
are returned, the date field is filled in whatever language the
investigator has set as their Word default. Could be Russian, Czech,
Spanish, French, and so on.

Is there any way to set or lock the language in a text field?

Selecting the form field, or the whole document, and setting the
language has no effect on the languge that shows up in the text field.

Sorry if this has been dealt with recently.

John Morris
 
G

Graham Mayor

Hmmmm. There are several varieties of English with different date formats,
but assuming you can persuade users to run macros, it is possible to format
the date in the variety of English that you prefer. In the following
example, the date field is Text1 and the default format is configured as "d
MMMM yyyy" in the field properties. The two macros are run on exit and entry
to the fields as their names imply. The entry macro clears any date text
from the field and prompts for the date in the format "DD/MM/YY". If the
date is entered in the field in this format, the exit macro formats the
field in the indicated language in the format selected in the field
properties. I have inserted both UK English (active) and Greek (inactive) to
demonstrate that it does in fact work.

Sub DateOnExit()
With ActiveDocument.FormFields("text1")
.Range.LanguageID = wdEnglishUK
'.Range.LanguageID = wdGreek
.Result = .Result
End With
End Sub

Sub DateOnEntry()
ActiveDocument.FormFields("text1").Result = ""
MsgBox "Enter date in the format 'DD/MM/YY'"
End Sub

http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

John Morris

Hmmmm. There are several varieties of English with different date formats,
but assuming you can persuade users to run macros, it is possible to format
the date in the variety of English that you prefer. In the following
example, the date field is Text1 and the default format is configured as "d
MMMM yyyy" in the field properties. The two macros are run on exit and entry
to the fields as their names imply. The entry macro clears any date text
from the field and prompts for the date in the format "DD/MM/YY". If the
date is entered in the field in this format, the exit macro formats the
field in the indicated language in the format selected in the field
properties. I have inserted both UK English (active) and Greek (inactive) to
demonstrate that it does in fact work.

Sub DateOnExit()
With ActiveDocument.FormFields("text1")
.Range.LanguageID = wdEnglishUK
'.Range.LanguageID = wdGreek
.Result = .Result
End With
End Sub

Sub DateOnEntry()
ActiveDocument.FormFields("text1").Result = ""
MsgBox "Enter date in the format 'DD/MM/YY'"
End Sub

http://www.gmayor.com/installing_macro.htm

Excellent. It worked perfectly and does exactly what is needed.

Thanks for this.

John Morris
 

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