Group:  Microsoft Word ยป microsoft.public.word.vba.beginners
Thread: Userform Creation for data entry/parsing

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Userform Creation for data entry/parsing
jliddil[ at ]gmail.com 28.09.2006 17:23:39
My idea is to create a text form field that On Entry open a user form.
this form has four text entry boxes. The first box is set to 5 places
in the format AA111. Text box 2, and 3 allows up to three numbers
places (1, 12, 123, 001, 012). box 4 allows up to 6 numbers.

I then want the data to populate the text from field in the format
Field1Field2-Field3-Field4 with an leading zeros removed.

I have arough idea that I can use CLng to remove the leading zeros,
concatenate the four fields, some how. I can't seem to figure out the
code details. help?

Jim

Re: Userform Creation for data entry/parsing
"Jay Freedman" <jay.freedman[ at ]verizon.net> 29.09.2006 19:58:45
Let's assume the text-entry boxes on the userform are named Field1 through
Field 4 as you indicated. Then in the _Click procedure of the OK command
button, use code like this:

ActiveDocument.FormFields("Text1").Result = _
Field1.Text & _
CLng(Field2.Text) & "-" & _
CLng(Field3.Text) & "-" & _
CLng(Field4.Text)

(Notice the space before each underscore; it's required so that all the
lines are part of the same statement.)

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

jliddil[ at ]gmail.com wrote:
[Quoted Text]
> My idea is to create a text form field that On Entry open a user form.
> this form has four text entry boxes. The first box is set to 5 places
> in the format AA111. Text box 2, and 3 allows up to three numbers
> places (1, 12, 123, 001, 012). box 4 allows up to 6 numbers.
>
> I then want the data to populate the text from field in the format
> Field1Field2-Field3-Field4 with an leading zeros removed.
>
> I have arough idea that I can use CLng to remove the leading zeros,
> concatenate the four fields, some how. I can't seem to figure out the
> code details. help?
>
> Jim


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net