Prevent scientific formatting when creating excel sheet from vbscr

  • Thread starter programinfinity
  • Start date
P

programinfinity

Hi,
I'm trying to create an excel sheet using html <table> tags from vbscript.
One of the columns contains numbers 14 digits long. On opening the file
created it shows the numbers as 2.3024E+13.
I tried adding an apostrophe ( ' ) before the number. But sadly the
apostrophe also shows on the excel sheet.
How can I prevent the number to convert to scientific format and display all
14 digits either as number or text?

Thanks in advance,
programinfinity
 
J

Jacob Skaria

Format the column to Text before placing the text

Range("A:A").NumberFormat = "@"

If this post helps click Yes
 
P

programinfinity

thanks for the reply,
the excel sheet is also newly created by the vbscript so i cannot format the
column before. is there something I can set in the column properties while
writing out the excel file the same way I can set widths - like using
'mso-width-source:userset;mso-width-alt:3754;width:105pt'?

i need to email out the excel sheet from the script so I can't edit and
change the format either.

- programinfinity
 
T

Tim Williams

<table>
<tr>
<td style='mso-number-format:\@;'>12345678912345667</td>
</tr>
</table>

Tim
 
T

Tim Williams

No problem.

The easiest way to get the correct style is to format cells in an Excel
sheet, save as HTML, and inspect the source for the styles.


Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top