Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Prevent scientific formatting when creating excel sheet from vbscr

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Prevent scientific formatting when creating excel sheet from vbscr

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Prevent scientific formatting when creating excel sheet from v

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 298
Default Prevent scientific formatting when creating excel sheet from v

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

Tim


"programinfinity" wrote in
message ...
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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Prevent scientific formatting when creating excel sheet from v

Thank you! It worked perfectly.

- programinfinity

"Tim Williams" wrote:

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

Tim


"programinfinity" wrote in
message ...
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




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 298
Default Prevent scientific formatting when creating excel sheet from v

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

"programinfinity" wrote in
message ...
Thank you! It worked perfectly.

- programinfinity

"Tim Williams" wrote:

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

Tim


"programinfinity" wrote in
message ...
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






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I prevent Excel from automatically creating hyperlinks? keholcomb Excel Discussion (Misc queries) 2 July 1st 09 05:44 PM
Prevent conversion of numeric text string to scientific notation StuckWithExcelAlas Excel Discussion (Misc queries) 1 December 28th 07 07:02 PM
How to prevent General format from using scientific notation? jim swanson Excel Discussion (Misc queries) 1 March 28th 07 02:34 PM
Prevent Scientific Notation robbyp Excel Discussion (Misc queries) 3 February 20th 07 03:13 PM
How to get the number of used rows from excel spreadsheet in VBScr JP Excel Programming 2 January 13th 05 07:27 PM


All times are GMT +1. The time now is 08:47 PM.

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

About Us

"It's about Microsoft Excel"