• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Need help with a date/excel applescript please.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Need help with a date/excel applescript please.
      • From: David Wignall <email@hidden>
    • Re: Need help with a date/excel applescript please.
      • From: cougar <email@hidden>
    • Re: Need help with a date/excel applescript please.
      • From: Paul Berkowitz <email@hidden>
  • Prev by Date: Re: Calling Applications
  • Next by Date: Re: Need help with a date/excel applescript please.
  • Previous by thread: Re: Accessing a 'Scripting Addition's Features
  • Next by thread: Re: Need help with a date/excel applescript please.
  • Index(es):
    • Date
    • Thread