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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Fields in Word 4

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
GB
Hello,

We have a word doc which has been created using form fields.

i would like to make the form field width to be stretched to my desired length by default.

I've managed to set the max input length, but the field is still only a tiny fraction of the desired width by default.

Is there a way to make form fields your desired width or is the default width non-changeable and will only expand as you type in the field?

Cheers,
1DMF

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 





Hi,

Put the Text FormField in a Table. Make the Table column width the desired width of your FormField. Although the Field length will technically not be the length your anticipate, it will act as if it were.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Formfields are sized to the content. Frankly, I do not know what Skip is talking about. A formfield in a table cell (with the column width explicitly set) will still be sized according to content.

Why do you want the formfield to be longer than its content?

If you really want something of an explict width, regardless of content, you may consider using an ActiveX textbox (from the Controls toolbar) rather than a formfield. These can be sized explicitly.

faq219-2884

Gerry
My paintings and sculpture
 
Hey Skip,

Put the Text FormField in a Table. Make the Table column width the desired width of your FormField. Although the Field length will technically not be the length your anticipate, it will act as if it were.

not really as you still need to click in the beginning of the field for you to actually start typing.

OK you can F11 , through each field, but this for is for someone who can barely use Word let alone remember shortcut keys!

I understand what you're saying as the missus suggested the exact same idea, but it wasn't what the bod in compliance (the one who designed the form) wanted to hear!

I guess it's just another one of those anoying things you have to put up with when you invest in MS technology.

Would be nice if you could drag the field to actually be the width you desire or even a setting somewhere that lets you key in the width.

oh well thanks for your reply!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
If you really want something of an explict width, regardless of content, you may consider using an ActiveX textbox (from the Controls toolbar) rather than a formfield. These can be sized explicitly.

hmm but I bet that will cause all sorts of security issues and pop-ups, well i'll put the idea forward anyhow.

Thanks Fumei

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 




Gerry,

Had I felt persistent, I would have asked a question first. Bit I assumed that the OP wanted his/her form fields to line up as if they were in columns. For instance, suppose I had a FAX form that I wanted the FROM and From FAX and TO and TO FAX to line up like...
[tt]
From: Fax:
To: Fax:
[/tt]
so that the user would enter...
[tt]
From: [highlight]SkipVought[/highlight] Fax: [highlight]999-999-9999[/highlight]
To: [highlight]fumi[/highlight] Fax: [highlight]000-000-0000[/highlight]
[/tt]
or
[tt]
From: [highlight]SkipVought[/highlight] Fax: [highlight]999-999-9999[/highlight]
To: [highlight]fumi ahd his whole clan[/highlight] Fax: [highlight]000-000-0000[/highlight]
[highlight]inlaws and outlaws [/highlight]
[/tt]

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I did not think it was a line up issue, but a size issue.

i would like to make the form field width to be stretched to my desired length by default.

To me, this means the OP wants the formfield visible width to be "my desired length"...regardless of content. They do not work that way. Formfields are sized to content. There is a default (empty content) size, but I know of no way to change that. And, any content input will in fact re-size the formfield to that content.

However, again, I am interested to know WHY this is desired/significant. Why do you want a specific default size?

faq219-2884

Gerry
My paintings and sculpture
 





And my interpretation of "my desired length by default" is "Make the Table column width the desired width of your FormField. Although the Field length will technically not be the length your anticipate, it will act as if it were."

But it's ALL based on assumptions.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
And my interpretation of "my desired length by default" is "Make the Table column width the desired width of your FormField. "

An interesting interpretation (perhaps better described as, hmmmm, a blind assumption?).....as the OP never used the word "table" anywhere in the post. No table, or column, was ever mentioned.

Methinks, it is that Excel-centric thing again.

Just kiddin' ya, Skip.

faq219-2884

Gerry
My paintings and sculpture
 
Hi folks,

You can always set the default text to as many space (or other) characters as you want to force the formfield's with to the required initial width. Of course, one you start typing in the formfield, it'll collapse to whatever the inserted string requires - unless you select a position within the formfield before you start typing (then you'll simply be adding to the formfield's content).

[MS MVP - Word]
 
However, again, I am interested to know WHY this is desired/significant. Why do you want a specific default size?

Because the employee who created this from requested them to be a fixed width.

My job is to supply the staff IT solutions on request, not worry about why they make the request or why staff cannot be trained correctly in the use of the software our employer provides nor why they employ people who do not have basic PC skills or experience in simple products such as MS Word.

Mine it not to reason why, mine is just to do or die.

The last thing I expected from this simple question was to start WWIII.

chill out guys it's only a stupid word document, the staff , me and you will all live through this , beleive me!

Now step away from the keyboard!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Quote: "If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

LOL: That is what I always say
 
Hi 1DMF,
My job is to supply the staff IT solutions on request, not worry about why they make the request or why staff cannot be trained correctly in the use of the software our employer provides nor why they employ people who do not have basic PC skills or experience in simple products such as MS Word.
In this case, what they're asking for isn't possible, so you can't fulfill the 'supply solutions on request' mandate. So, in this case, the 'employee who created this from' [sic] - whose responsibility it is to design a form that provides the best fit between the application's abilities and the users' needs - is just going to have to learn how to work within those parameters. Shock horror!

Cheers

[MS MVP - Word]
 
lol - It's no big deal, it won't be the first time i've had to say "it's not possible" , and i'm sure it won't be the last!

Allthough no-one could solve this post, i've awarded stars to everyone anyway just coz i'm that kinda guy :)

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Just as an afterthought, 'cuz I can...

Set the fields up, turn off form field shading, then protect the document. That way, you don't see the shading and they never know what the size of the field is.

cckens

"Not always my best shot, but I hit the target now and then"
-me
 
but if they don't click near the begining of the field they don't enter the input box, that's the problem they are having I think.

Are you just after a star ;-)

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Nope, starz are cool, but they're not the reason I provide feedback (I know, you smilie'd but I like to justify anyways). I believe that anything I know should be available... now I'm not always right, but I do have a few good ideas anyway..

I had to find a way to hide the fields in a doc for my users. They complained that they didn't like the way the shading made things look bad on print. I found that when I hid the shading and protected the document, the only thing they could do was fill-in the fields (and it starts on the first one and they can tab into the others) and the size of the fields becomes irrelevant 'cuz they can't see the size as it's now white. Fill-in protection is a wonderful thing...
I thought that others could use this as well... since armageddon seems to have passed on...


cckens

"Not always my best shot, but I hit the target now and then"
-me
 
I'm not sure how to do this linking on TGML so bear with me, but I've set an example of my form on a download server:

to-gnrc.doc

You can see what it looks like as it is protected, the form field shading is turned off. No pwd on the protection. Hope this is what they are looking for!

cckens

"Not always my best shot, but I hit the target now and then"
-me
 
If the document is protected, Tab moves between the formfields anyway. So they do not need to "click near the begining of the field they don't enter the input box".

There is no war. We are horsing around, really. As macropod mentions, you can make a default length by putting in spaces as the default, but this is not all that relevant as ANY input will - as I have previously stated - resize the formfield to its current content. The default length is simply....the current length, before any other input.

Sorry, but that is how they work.

faq219-2884

Gerry
My paintings and sculpture
 
If you place the following code in a code module and then set each of your text field's Run macro on Exit to TextFormFieldExit, all the form fields will be padded to their maximum length.
Code:
Public Sub TextFormFieldExit()
    Dim ff As FormField
    Dim MaxLength As Integer
    
    For Each ff In ActiveDocument.FormFields
        If (ff.TextInput.Valid) Then
            MaxLength = ff.TextInput.Width
            If (MaxLength = 0) Then MaxLength = 50 '<- Default to 50
            
            If (Len(ff.Result) < MaxLength) Then
                ff.Result = ff.Result & String(MaxLength - Len(ff.Result), " ")
            End If
            
        End If
            
    Next

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top