Fun with Excel
Fun with Excel
- Subject: Fun with Excel
- From: David Crowe via AppleScript-Users <email@hidden>
- Date: Wed, 6 May 2020 13:52:42 -0600
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
_______________________________________________
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