Re: Date formatting
Re: Date formatting
- Subject: Re: Date formatting
- From: David Wignall <email@hidden>
- Date: Thu, 25 Apr 2002 14:40:17 +1200
on 25/4/02 5:02 am, Eric Phillips at email@hidden wrote:
>
This question is not directly related to scripting so if someone feels that it
>
is more appropriate to answer offline that is fine. In Excel I have a script
>
that formats a column as text then inserts the file name into that column. The
>
file name is something like April 2001.xls. What I want is just April 2001 so
>
I do a find and replace to get rid of the .xls. When I do this it converts the
>
text to a date. I can format the date to say April 2001 but I want to import
>
this file into FMP and the date becomes 4/1/01. The end goal is to have FMP
>
show the field as April 2001. If it does that as a date or as text I don't
>
care. Does anyone have suggestions on how to keep Excel from changing the
>
format to a date or have FMP express the date as April 2001?
It's the find and replace that's doing it. You can avoid it by ridding
yourself of the ".xls" in code.
tell Application "Microsoft Excel"
set NumberFormat of Range "R1C1:R10C1" to "@"
set FormulaR1C1 of Range "R1C1:R10C1" to "April 2001.xls"
repeat with i from 1 to 10
set str to text of Range ("R" & i & "C1")
set str to text 1 thru -5 of str
set FormulaR1C1 of Range ("R" & i & "C1") to str
end repeat
end tell
There's the opportunity in there to get tricky with lists (set AnArray to
FormulaR1C1 of Range "R1C1:R10C1"), but hey. As to whether or not FMP will
coerce the text back to a date is beyond me. I'm afraid.
--
hth
Dave
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.