View Single Post
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default Scientific notation

There are no facilities in Word's numeric formatting switch to produce
results in scientific notation. You could probably produce a sequence of {
IF } fields that would do it if you knew your exponents were going to fall
within a reasonably small range, but otherwise, I think you need to find a
way to use the Format function in VBA, which can do it - for example

format(1234.5,"0.00E+00")

returns


1.23E+03





{ IF



so the question is how to get VBA to process your number. That depends on
what you're doing - if it's a one-off, it might be enough simply to create a
VBA macro that formats the selected text.



A possible approach is to nest your field inside a DATABASE field. If you're
using Word 2003 and probably 2002, you should be able to do the following



{ DATABASE \d "C:\\a\\a.mdb" \s "SELECT format(1234.5,'0.00E+00')" }



where a.mdb is valid Access .mdb file (it doesn't need to have any tables in
it).



If the field you want to format is, e.g.



{ =1234.5 }



then nest it, e.g.



{ DATABASE \d "C:\\a\\a.mdb" \s "SELECT format({ =1234.5 },'0.00E+00')" }



wher all the {} are the field braces you can insert using ctrl-F9



In theory, because you are only returning a single row and column, Word does
not put the result in a table. But in Word 2003 I've noticed that the
DATABASE field can insert an additional paragraph mark which may make this
approach unusable.



Peter Jamieson








"MarkTheNuke" wrote in message
...
How do I display the results of a calculated field in scientific notation.
Is this possible. Thanks in advance.