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
|