A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Wrong (cell) number format when data pulled from xls file to Word



 
 
Thread Tools Display Modes
  #1  
Old August 21st, 2009, 07:09 PM posted to microsoft.public.word.docmanagement
spidie_man
external usenet poster
 
Posts: 1
Default Wrong (cell) number format when data pulled from xls file to Word

I have an excel 2007 spreadsheet from which some data is being extracted
(using mail merge and SQL) and put in a word document. I am able to get the
data in the word document, but some of the cells are being displayed in
scientific notation. They have 6 or 10 digits after the decimal place, I just
want 2 digits after the decimal place. I have checked the format of the cells
in the excel spreadsheet, over there they are being displayed properly.

In the spreadsheet, all cells have the same format, but only a few of these
cells are not being displayed properly when they are pulled into Word 2007.

Does anyone know how to fix this?
  #2  
Old August 21st, 2009, 09:44 PM posted to microsoft.public.word.docmanagement
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default Wrong (cell) number format when data pulled from xls file toWord

Are they really using scientific notation (e.g. 1.234+E5) ? Or are they
showing extra digits because of rounding errors, e.g. 1.459999 rather
than 1.45 ?

If it's rounding errors, you should be able to use numeric format
switches in the relevant MERGEFIELD fields, e.g. use Alt-F9 to show the
field code and change

{ MERGEFIELD mynumber }
or
{ MERGEFIELD mynumber \*Mergeformat }
to e.g.
{ MERGEFIELD mynumber \#0.00 }


If that does not do what you need,
a. you may find the following page useful (although I don't have an
explanation if the numbers really are coming across with E-notation).

http://tips.pjmsn.me.uk/t0003.htm

b. if you are issuing SQL in an OpenDataSource call, you may be able
to use Jet/VBA formatting functions to get the results you need.

Peter Jamieson

http://tips.pjmsn.me.uk

spidie_man wrote:
I have an excel 2007 spreadsheet from which some data is being extracted
(using mail merge and SQL) and put in a word document. I am able to get the
data in the word document, but some of the cells are being displayed in
scientific notation. They have 6 or 10 digits after the decimal place, I just
want 2 digits after the decimal place. I have checked the format of the cells
in the excel spreadsheet, over there they are being displayed properly.

In the spreadsheet, all cells have the same format, but only a few of these
cells are not being displayed properly when they are pulled into Word 2007.

Does anyone know how to fix this?

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:24 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.