View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Prevent scientific formatting when creating excel sheet from v

Using vbscript...

Set xlApp = CreateObject("Excel.Application")
Set xlwbk = xlApp.Workbooks.Add
'If you need to format the entire workbook
xlwbk.Sheets(1).Cells.NumberFormat = "@"

'If you need to format Col A
xlwbk.Sheets(1).Range("A:A").NumberFormat = "@"

If this post helps click Yes
---------------
Jacob Skaria


"programinfinity" wrote:

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

"Jacob Skaria" wrote:

Format the column to Text before placing the text

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

If this post helps click Yes
---------------
Jacob Skaria


"programinfinity" wrote:

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