Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.pagelayout
Congenital Kano Congenital Kano is offline
external usenet poster
 
Posts: 5
Default UserForm data manipulation - trailing spaces and dimming/summing textbox fields

I've successfully created a template with a UserForm that prompts for data and merges this (via bookmarks) with the template text. Just a couple of questions remain, and Help isn't all that helpful.

In Word 2003 (creating a form letter where addressee info and two numbers are entered in UserForm):

1. The textbox text, when embedded in the doc text via bookmark, seems to always include a trailing space (i.e., "Name_"). Is there a way to trim this space? In salutation line of letter I end up with "Dear Mrs. Jones_:" instead of "Dear Mrs. Jones:" (underscore represents space here).

2. I need to add the numerical contents of one textbox with a constant value, which is hard-coded into template. Scratching my head trying to figure out how I can set the properties of the textbox entry (ideally to monetary nnn.nn format) and then add constant and print sum linked to another bookmark. Suggestions?

Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.word.pagelayout
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default UserForm data manipulation - trailing spaces and dimming/summing textbox fields

Instead of using bookmarks, insert { DOCVARIABLE varName } fields where you want the data to appear

Then in your userfrom code, use

With ActiveDocument
.Variables("varAddressee").Value = txtAddressee.Text
' etc
.Variables("varAmount").Value = Format((nnn.nn + Val(txtAmount.Text)), "$#,###,00")
.Range.Fields.Update

where nnn.nn is the constant value that you want added to the number entered into the textbox.

Alternatively, you could do the addition and formatting with a field construction { = (nnn.nn + { DOCVARIABLE varAmount }) \# ,#.00 }

You must use Ctrl+F9 to insert each pair of field delimiters { }

--
Hope this helps

Doug Robbins - Word MVP
Please reply only to the newsgroups unless you wish to avail yourself of my services on a paid, professional basis.

"Congenital Kano" wrote in message ...
I've successfully created a template with a UserForm that prompts for data and merges this (via bookmarks) with the template text. Just a couple of questions remain, and Help isn't all that helpful.

In Word 2003 (creating a form letter where addressee info and two numbers are entered in UserForm):

1. The textbox text, when embedded in the doc text via bookmark, seems to always include a trailing space (i.e., "Name_"). Is there a way to trim this space? In salutation line of letter I end up with "Dear Mrs. Jones_:" instead of "Dear Mrs. Jones:" (underscore represents space here).

2. I need to add the numerical contents of one textbox with a constant value, which is hard-coded into template. Scratching my head trying to figure out how I can set the properties of the textbox entry (ideally to monetary nnn.nn format) and then add constant and print sum linked to another bookmark. Suggestions?

Thanks in advance.
  #3   Report Post  
Posted to microsoft.public.word.pagelayout
Congenital Kano Congenital Kano is offline
external usenet poster
 
Posts: 5
Default UserForm data manipulation - trailing spaces and dimming/summing textbox fields

Thanks! Got it worked out.
"Doug Robbins - Word MVP" wrote in message ...
Instead of using bookmarks, insert { DOCVARIABLE varName } fields where you want the data to appear

Then in your userfrom code, use

With ActiveDocument
.Variables("varAddressee").Value = txtAddressee.Text
' etc
.Variables("varAmount").Value = Format((nnn.nn + Val(txtAmount.Text)), "$#,###,00")
.Range.Fields.Update

where nnn.nn is the constant value that you want added to the number entered into the textbox.

Alternatively, you could do the addition and formatting with a field construction { = (nnn.nn + { DOCVARIABLE varAmount }) \# ,#.00 }

You must use Ctrl+F9 to insert each pair of field delimiters { }

--
Hope this helps

Doug Robbins - Word MVP
Please reply only to the newsgroups unless you wish to avail yourself of my services on a paid, professional basis.

"Congenital Kano" wrote in message ...
I've successfully created a template with a UserForm that prompts for data and merges this (via bookmarks) with the template text. Just a couple of questions remain, and Help isn't all that helpful.

In Word 2003 (creating a form letter where addressee info and two numbers are entered in UserForm):

1. The textbox text, when embedded in the doc text via bookmark, seems to always include a trailing space (i.e., "Name_"). Is there a way to trim this space? In salutation line of letter I end up with "Dear Mrs. Jones_:" instead of "Dear Mrs. Jones:" (underscore represents space here).

2. I need to add the numerical contents of one textbox with a constant value, which is hard-coded into template. Scratching my head trying to figure out how I can set the properties of the textbox entry (ideally to monetary nnn.nn format) and then add constant and print sum linked to another bookmark. Suggestions?

Thanks in advance.
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing trailing spaces in a table Kamran Microsoft Word Help 6 October 22nd 08 11:17 PM
Pasting into tables adds trailing spaces MossMan Tables 0 March 7th 08 08:05 PM
trim trailing spaces in mergefield claudio Mailmerge 1 February 5th 08 10:15 PM
Trailing spaces in columns Dustin Page Layout 1 August 31st 06 08:05 PM
Underline trailing spaces not staying on V-ger Microsoft Word Help 3 June 29th 05 08:37 PM


All times are GMT +1. The time now is 11:43 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"