View Single Post
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default How do I maintain a numeric format when importing data from a xls

Hi WC,

Using a DDE connection usually does the trick. If that isn't sufficient, you can add formatting switches to the mergefields.

For example -

Mailmerge Number Formatting:
.. select the field;
.. press Ctrl-F9 to reveal the field coding. It should look something like {MERGEFIELD MyData};
.. edit the field so that you get {MERGEFIELD MyData \# $,0.00;($,0.00)};
.. position the cursor anywhere in this field and press F9 to update it;
.. run your mailmerge.
The precision of the displayed value is controilled by the '0.00'. You can use anything from '0' to '0.000000000000000'.

If you add a final ';' to the formatting switch (eg \# $,0.00;($,0.00) any zero values will be suppressed, whether resulting from
empty fields or from fields containing 0s.

Mailmerge Percentage Formatting:
.. select your mergefield, which will look something like «Percent»;
.. press Ctrl-F9 to wrap another field around it, thus - { «Percent» };
.. edit the field so that you get {=«Percent»*100 \# 0.00%};
.. position the cursor anywhere in this field and press F9 to update it;
.. run your mailmerge.
The precision of the displayed value is controilled by the '0.00'. You can use anything from '0' to '0.000000000000000'.

Mailmerge Phone Number Formatting:
.. select the mergefield;
.. press Shift-F9 to expose the field coding. It should look something like {MERGEFIELD MyData}, where 'MyData' is your data field's
name;
.. delete everything between 'MyData' and the closing field brace;
.. add ' \# "(000) 0000 0000"' after 'MyData', so that you end up with {MERGEFIELD MyData \# "(000) 0000 0000"};
.. position the cursor anywhere in this field and press F9 to update it;
.. run your mailmerge.

Mailmerge Date Formatting:
.. select the mergefield;
.. press Shift-F9 to expose the field coding. It should look something like {MERGEFIELD MyDate} where 'MyDate' is your mergefield's
name;
.. delete anything appearing after the mergefield's name and add '\@ "d MMMM yyyy"' to the field, as in {MERGEFIELD MyDate \@ "d MMMM
yyyy"}. With this switch your date will come out as '2 August 2008'. Other possible date formatting switches include:
. \@ "dddd, d MMMM yyyy";
. \@ "ddd, d MMMM yyyy";
. \@ "d MMM yyyy";
. \@ "dd/MMM/yyyy";
. \@ "d-MM-yy";
Note: you can use the D, M & Y expressions in any order you like, but you must use uppercase 'M's for months.
.. position the cursor anywhere in this field and press F9 to update it;
.. run your mailmerge.

Mailmerge Time Formatting:
.. select the mergefield;
.. press Shift-F9 to expose the field coding. It should look something like {MERGEFIELD MyTime} where 'MyTime' is your mergefield's
name;
.. delete anything appearing after the mergefield's name and add '\@ "h:m"', as in {MERGEFIELD MyTime \@ "h:m am/pm"}. Note: you must
use lowercase 'm's for minutes;
.. if you want the hours and/or minutes to display leading 0s, change 'h' to 'hh for hours and 'm' to 'mm' for minutes;
.. position the cursor anywhere in this field and press F9 to update it;
.. run your mailmerge.


--
Cheers
macropod
[MVP - Microsoft Word]


"WC" wrote in message ...
How do I maintain a numeric format when importing data from a xls