Group:  Microsoft Excel ยป microsoft.public.excel.sdk
Thread: How to set date as result of function

How to set date as result of function
Chris <chris[ at ]chrisbird.com> 11/27/2008 10:59:02 AM
I have now coded an XLL with user interface, and everything is
working, however I have one problem relating to dates and date
formatting.
I return data as an array X-Y from a UDF using the Excel API with C++.
The array contains dates, integers and floating point numbers in
different columns.
At present I am returning dates as floats, to which formatting can
then be applied. Ideally I would like the date to appear as a date
immediately, thus removing the need for formatting.
Can anyone suggest the correct way of tackling this problem in Excel?

Thanks,

Chris.
Re: How to set date as result of function
"Steve Dalton" <NOsteveSPAM(at)NOeigensysSPAM(dot)com> 11/27/2008 7:34:11 PM
Hi Chris

Can you distinguish between your dates and other numerical values in a way
that you can test with simple Excel formulae? For example, are all your
other numerical return values integers? Or are non-date valus in some range
lower than a typical/minimum date value? If so, you can use conditional
formatting. Not only does this achieve what you want, but also separates
the consideration of the values you return from considerations of how those
values should be displayed, which is a good thing.

Regards

Steve Dalton



"Chris" <chris[ at ]chrisbird.com> wrote in message
news:0210af42-1d9a-4b5f-b72a-e8cb5ec322d4[ at ]20g2000yqt.googlegroups.com...
[Quoted Text]
>I have now coded an XLL with user interface, and everything is
> working, however I have one problem relating to dates and date
> formatting.
> I return data as an array X-Y from a UDF using the Excel API with C++.
> The array contains dates, integers and floating point numbers in
> different columns.
> At present I am returning dates as floats, to which formatting can
> then be applied. Ideally I would like the date to appear as a date
> immediately, thus removing the need for formatting.
> Can anyone suggest the correct way of tackling this problem in Excel?
>
> Thanks,
>
> Chris.


Home | Search | Terms | Imprint
Newsgroups Reader