Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel NUmber format IN VC++

Hi,
I wanted to Display a Text say it is "0011" in one particular cell
so for this I use this
range.SetNumberFormat(COleVariant("@"));
range.SetItem(COleVariant((long)(1)),COleVariant(( long)
(1)),COleVariant((LPCTSTR)csData));
but while it is put into the Excel.. it puts in the text as
"0011". But now say i close the Excel and again i reopen the same
file, that time the Text is displayed as "11" instaed of "0011"
COuld any one please help me about this....
ITS URGENT
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,344
Default Excel NUmber format IN VC++

Hi,

I'm not clear on what you are trying to do. Suppose you want to display a
number as 0011. Just set the format for the custom number format of 0000.
This format displays numbers to 4 digits with leading zeros where necessary.
Note this is not a text format but a number format. You enter the custom
code by choosing Format, Cells, Number tab, Custom, and typing 0000 into the
Type line on the right.

If you are trying to enter the numbers as text, not just format it as text
then
1. Format the range as text first
2. Then enter the number.

Both of these approaches could be recorded for use in code.


--
Thanks,
Shane Devenshire


" wrote:

Hi,
I wanted to Display a Text say it is "0011" in one particular cell
so for this I use this
range.SetNumberFormat(COleVariant("@"));
range.SetItem(COleVariant((long)(1)),COleVariant(( long)
(1)),COleVariant((LPCTSTR)csData));
but while it is put into the Excel.. it puts in the text as
"0011". But now say i close the Excel and again i reopen the same
file, that time the Text is displayed as "11" instaed of "0011"
COuld any one please help me about this....
ITS URGENT

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
Excel is defaulting to Number format instead of General format Kim Excel Discussion (Misc queries) 1 March 11th 10 01:25 PM
Excel number format Mibrayev Excel Discussion (Misc queries) 1 November 22nd 09 02:27 AM
convert text-format number to number in excel 2000%3f Larry Excel Discussion (Misc queries) 1 July 29th 05 08:18 PM
Number format based on number format of another cell in another workbook Rob Excel Programming 9 January 9th 05 04:30 PM
excel format cells/Number/Category: Number problem Matts Excel Discussion (Misc queries) 5 December 9th 04 09:47 PM


All times are GMT +1. The time now is 03:33 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"