Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2006

Tip: Looking for answers? Try searching our database.

Userform text field preset

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sol Apache - 18 Oct 2006 16:24 GMT
I am creating a letterhead template with a userform which has some of its
fields containing default data. I insert the default text in the ³Text²
field of the Properties list.

One of the fields has several lines of text, and the field is set to
Multiline = True but each time I try to insert the 2nd line of text it
overwrites the one I have already typed in.

Is there any way of having multiple line default text?

TIA
Greg Maxey - 18 Oct 2006 16:39 GMT
I think when you use multiline then the text that you want to type in
th text field wraps automatically to the available line length.

> I am creating a letterhead template with a userform which has some of its
> fields containing default data. I insert the default text in the ³Text²
[quoted text clipped - 7 lines]
>
> TIA
Sol Apache - 18 Oct 2006 17:14 GMT
Hi Greg
Thanks, but I don¹t want this. It is an address field so the lines will be
of different lengths with a return at the end.

The mutliline=yes allows the user to press return within the field to create
a new line of text.

I cannot restrict this field to certain line lengths, or to have separate
fields for the address, because the user may want to enter an alternate to
the default address with a different number of lines and of varying line
lengths.

So the text property field does not allow a default multi line entry?

On 18/10/06 16:39, in article
1161185998.939536.41380@e3g2000cwe.googlegroups.com, "Greg Maxey"
<gmaxey@mvps.org> wrote:

> I think when you use multiline then the text that you want to type in
> th text field wraps automatically to the available line length.
[quoted text clipped - 10 lines]
>>
>> TIA
Jean-Guy Marcil - 18 Oct 2006 17:10 GMT
Sol Apache was telling us:
Sol Apache nous racontait que :

> I am creating a letterhead template with a userform which has some of
> its fields containing default data. I insert the default text in the
[quoted text clipped - 5 lines]
>
> Is there any way of having multiple line default text?

Yes.

How are you inserting this second line?

Three ways:
1) While in the VBA editor, select your textbox. Wait a few seconds and
click on it again (Just make sure you do not do an actual double-click
because this will take you to the code pane with a Click event sub), you
should be able to type the default text directly in the text box instead of
going through the properties pane. Now, as you type, if, as you say,
MultiLine is set to True, the text will automatically wrap to the next line
when you get to the end. You can force a new line by hitting  CTRL-Enter

2) Just type the text in the Text property in the properties pane, if it is
too long, it will automatically wrap.

3) Use something like this in the Initialize event:

   Private Sub UserForm_Initialize()

   Me.TextBox1.Text = "This is the default text that should be" & vbCrLf &
"on many lines becasue it is too long."

   End Sub

Here I used a vbCrLf to force a nee line, but you could remove " & vbCrLf &
" and replace it by a single space and the text would automatically wrap.

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

Sol Apache - 18 Oct 2006 17:20 GMT
Thank you very much
Just tried this and it works, but on a Mac you have to press shift+return to
get it to a new line while in the editor. When the user is filling in the
form, s/he can press return for a new line.

Your email crossed my reply to Greg¹s

Thx very much for your help and suggestions.

Sol

On 18/10/06 17:10, in article OxaMe$s8GHA.4304@TK2MSFTNGP03.phx.gbl,

> Sol Apache was telling us:
> Sol Apache nous racontait que :
[quoted text clipped - 36 lines]
> Here I used a vbCrLf to force a nee line, but you could remove " & vbCrLf &
> " and replace it by a single space and the text would automatically wrap.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.