Need help with a date/excel applescript please.
Need help with a date/excel applescript please.
- Subject: Need help with a date/excel applescript please.
- From: montana <email@hidden>
- Date: Sun, 2 Feb 2003 12:11:24 -0600 (CST)
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
But when I run this I get a dialog window that says:
Saturday, February 1, 2003 12:00:00 AMSunday,
February 2, 2003 12:00:00 AM24 hours;0 minutes.
This is obviously incorrect and begins at the first "Cell" importation. Any ideas how to fix this?
Thanks.
SA
:)
_______________________________________________
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.