• 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
Re: Fun with Excel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fun with Excel


  • Subject: Re: Fun with Excel
  • From: Yvan KOENIG via AppleScript-Users <email@hidden>
  • Date: Wed, 6 May 2020 22:09:22 +0200


> Le 6 mai 2020 à 21:52, David Crowe via AppleScript-Users
> <email@hidden> a écrit :
>
> This code used to work:
>
>
> tell application "Microsoft Excel"
>       open workbook workbook file name
> "/Users/david/Documents/TheInfectiousMyth/Marketing/Email and Donors.xlsx"
>       tell workbook "Update Email List.xlsx"
>               tell worksheet "TIM Emails"
>                       -- Bail if already here
>                       set searchRange to range ("C2:C9999")
>                       try
>                               set foundRange to find searchRange what
> theEmailAddress
>                               -- If the email address is not present an error
> will mean that the following code is not executed
>                               tell me
>                                       activate
>                                       display dialog "Email address <" &
> theEmailAddress & "> already in file" giving up after 3
>                                       return
>                               end tell
>                       end try
>                       -- Find first blank row
>                       set blank to ""
>                       set searchRange to range ("C2:C9999")
>                       set foundRange to find searchRange what blank
>                       set theRow to first row index of foundRange as text
>                       set value of cell ("A" & theRow) to FirstName
>                       set value of cell ("B" & theRow) to LastName
>                       set value of cell ("C" & theRow) to theEmailAddress
>                       set value of cell ("D" & theRow) to DateString
>                       set value of cell ("E" & theRow) to "Email"
>               end tell
>               try
>                       save
>               on error errmsg number errnum
>                       tell me
>                               activate
>                               display dialog "Cannot save file. " & errmsg &
> " (" & errnum & ")"
>                       end tell
>               end try
>       end tell
> end tell
>
>
> But now it is generating an error on the “save” line. I tried:
> save it in <posix file string>
> save it in <apple file string>
> save in file <apple file string>
> save workbook “Update Email List.xlsx” in <apple file string>
>
> And all generate an Excel error that the object I’m trying to access does not
> exist:
> Cannot save file. The object you are trying to access does not exist (-1728)
>
> Quite likely Microsoft has auto-updated Excel. I wonder if anyone else has
> found a similar issue recently.
>
> Regards,
>       David Crowe
>


If my memory is right, it may be useful to create the file before saving in it.

tell application "System Events" to make new file at end of folder
"/Users/david/Documents/TheInfectiousMyth/Marketing/" with properties
{name:Update Email List.xlsx"}

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi
6 mai 2020 22:05:52


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Fun with Excel (From: David Crowe via AppleScript-Users <email@hidden>)

  • Prev by Date: Fun with Excel
  • Next by Date: Fun with Excel
  • Previous by thread: Fun with Excel
  • Next by thread: Fun with Excel
  • Index(es):
    • Date
    • Thread