Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Problem :SICK: Unable to Set Text Property of Range Class

:confused: Hi i Have tried dMuch to set the Value In THe excel sheet from VIasual Basic But Cant Set .the Value Are Stored in Excel as a number i.e. Cell Format is in Number. I Want to Change The Format of Cell To Text

OR

Set The Following Value in the Excel Sheet.

oSheet.Range("B2").Value = "0002e001"
plz try it. the VAlue Stored in Excel Sheet is :2.00 e 001

Reply Immediately
[421 byte] By [shivkant] at [2007-11-11 10:08:30]
# 1 Re: Problem :SICK: Unable to Set Text Property of Range Class
Excel thinks it is a number in scienctific notation because of the 'e' which is the exponent seperator. Try forcing the numeric format to be a string like this:
oSheet.Range("M3").Cells().NumberFormat = "@"
oSheet.Range("M3").Value = "0002e001"
Ron Weller at 2007-11-11 17:23:13 >
# 2 Re: Problem :SICK: Unable to Set Text Property of Range Class
Or simply precede the number with a single quote:

oSheet.Range("M3").Value = "'0002e001"
Phil Weber at 2007-11-11 17:24:13 >