Re: Need help with a date/excel applescript please.
Re: Need help with a date/excel applescript please.
- Subject: Re: Need help with a date/excel applescript please.
- From: David Wignall <email@hidden>
- Date: Mon, 03 Feb 2003 18:01:30 +1300
on 3/2/2003 7:11 AM, montana at email@hidden wrote:
>
Hi everyone-
>
>
I'm trying to create an excel template that I can add two different dates and
>
time into two cells formatted like such:
>
>
1/17/03 12:00
>
>
The applescript should take these two values, convert them to date objects, do
>
some calculations and return a date oblect that is the difference of the first
>
two date objects as text in a new cell on the spreadsheet.
>
>
This is what I have so far with the last line being a test:
>
tell application "Microsoft Excel"
>
Activate
>
set sdate to Cell "B1" as date
>
set edate to Cell "B2" as date
>
set diff to edate - sdate
>
set hoursdiff to diff div hours
>
set secsLO to diff mod hours
>
set minsdiff to secsLO div minutes
>
set answ to hoursdiff & " hours;" & minsdiff & " minutes." as text
>
--set Cell "B3" to answ
>
display dialog (sdate & edate & answ) as text
>
end tell
Why not use Excel to do the calculation in B3, format B3 with [h]" hours
"mm" minutes" and use
display dialog (text of Range ("B3") as string)
--
Dave
"Perhaps the truth is less interesting than the facts?"
Amy Weiss,
The RIAA's Senior Vice President of Communications
Email to The Register
_______________________________________________
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.