Re: Date value at Excel 2004
Re: Date value at Excel 2004
- Subject: Re: Date value at Excel 2004
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 07 Dec 2005 08:28:10 -0800
- Thread-topic: Date value at Excel 2004
Title: Re: Date value at Excel 2004
On 12/7/05 5:51 AM, "Gonçalo Miguel" <email@hidden> wrote:
I ask Excel to give me the date of a certain cell. The cell as the date like this "13/04/2005"
The scrip:
tell application "Microsoft Excel"
activate
set data1 to get value of range "A6" of sheet 2 as date
end tell
But the result of the scrip return on this:
date "Wednesday, April 13, 2005 00:00:00"
Can anyone help
If what you want is the string "13/04/2005", why are you coercing it 'as date'? That gets you an AppleScript date object, which will always be of the type you got. I am a little puzzled though: it seems to indicate that in Systems Preferences/International. you have the "long" date format in US style, whereas Excel seems to understand a short date in dd/mm/yyyy (13/04/2005) format, rather than m/d/yyyy (US format).
How does the cell actually appear as text?
If what you want is simply the same text as you see in the cell then
set data1 to get string value of range "A6" of sheet 2
will do that. 'string value' gets you just the text. If the actual value is a date, or number, in any format, 'value' is going to get you the AppleScript date or number object (even when you don't specify 'as date'). On the other hand, if Excel is displaying a date in some other format, you can get the value - an AppleScript date - and then get the 'short date string' of the result to get it in your standard short date format as specified in System Preferences/International:
set dateObject to value of range "A6" of sheet 2 -- as date
set data1 to short date string of dateObject
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden