View Single Post
  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Cindy M. Cindy M. is offline
external usenet poster
 
Posts: 2,416
Default Text Form Field Too Small

What I am trying to accomplish is to set columns two and four to be
"Text Form Fields". If someone clicks in the area next to "Request
Number" and enters a single character I don't want word to
automatically readjust the Text Form Field size to 1 character. This
causes big problems if someone wants to click back and edit the field.
They would have to click directly on the single character because the
rest of the area is now uneditable whitespace.

There's not a lot you can do, really. A possibility would be a macro
that fires when the form field is exited. If the content is less than n
characters (however many you find is useful), the macro will add spaces
to the end of the text. If it's more than n characters, it can delete
any spaces at the end of the text. Rough example

Sub TrimFormField()
Dim ffld As Word.FormField
Dim content As String
Dim minNumChars As Long

minNumChars = 5
Set ffld = ActiveDocument.FormFields(Selection.Bookmarks(1).N ame)
Debug.Print ffld.Name
content = ffld.Result
If Len(content) minNumChars Then
content = content & Space(minNumChars - Len(content))
Else
content = RTrim(content)
End If
ffld.Result = content
End Sub


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
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 :-)