Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default What Range property distinguishes a double from a datetime?

I am using vs2005 and c#.

I am passing a range object into C# and trying to determine what type
of value it is. In case it's a datetime I want to convert it using
DateTime.FromOADate. I can't find the right property to help me
distinguish a datetime from a double. Excel seems to know. I see the
Range.NumberFormat looks different but using this seems like a real
kludge.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default What Range property distinguishes a double from a datetime?

I could be wrong but I don't think Excel understands DATETIME although a cell
format can show it. The closest is

typename(Range("c1").value)

would return Date if c1 contains a timestamp or a date.

"LJ" wrote:

I am using vs2005 and c#.

I am passing a range object into C# and trying to determine what type
of value it is. In case it's a datetime I want to convert it using
DateTime.FromOADate. I can't find the right property to help me
distinguish a datetime from a double. Excel seems to know. I see the
Range.NumberFormat looks different but using this seems like a real
kludge.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default What Range property distinguishes a double from a datetime?

In .NET there does not seem to be a Value property. I use Value2.
Text also displays the text value. I have tried the get_Value method
but it takes a RangeValueDataType argument which is really what I am
looking for.

Excel seems to know when you enter a date that it should be transformed
into a double for storage but displayed as a date (it automatically
stores "m/d/yyyy" as the format for example). I am wondering if it
stores this information anywhere such as a datatype field or if it just
does the translation and set the format.

It seems like storing the RangeValueDataType object as a property of
the range would have been a nice thing.

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
Property Let: assign return value of Double when passing String Tetsuya Oguma Excel Discussion (Misc queries) 1 March 3rd 06 08:01 AM
range property of range object Woody[_3_] Excel Programming 1 June 23rd 05 09:04 PM
Row and Column from Used Range property?? C. Johnson Excel Programming 1 March 31st 05 07:51 PM
Range Resize property jacqui[_2_] Excel Programming 7 February 24th 04 06:11 PM
using a range with isnumber property chick-racer[_33_] Excel Programming 2 November 12th 03 06:53 PM


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