Re: Excel save with overwrite currently not supported
Re: Excel save with overwrite currently not supported
- Subject: Re: Excel save with overwrite currently not supported
- From: Shane Stanley via AppleScript-Users <email@hidden>
- Date: Mon, 26 Aug 2019 10:17:30 +1000
On 26 Aug 2019, at 8:32 am, Thomas Maffucci via AppleScript-Users
<email@hidden> wrote:
>
> How do I avoid being asked permission to overwrite an existing workbook in
> applescript
> when doing a
> save workbook as workbook_name
> I am moving from macOS 10.12: Sierra & Excel 15.41 to macOS 10.14: Mojave and
> Excel 16.16.13
I think you'll find it's nothing to do with the fact that you're overwriting,
but rather that you're saving to a folder outside Excel's sandbox. In most apps
this can be worked around by passing a file or alias rather than a simple path,
which then magically provides authorization for that file's path, but not Excel
-- it insists on a path only.
The easiest solution is to include this code before your script does anything
else with Excel:
set sd to path to startup disk
tell application id "com.microsoft.Excel" -- Microsoft Excel
try
close sd -- will error
end try
end tell
The simple act of passing an alias via script is enough to provide
authorization for its path, and in this case path to startup disk actually
covers pretty much everywhere.
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>
_______________________________________________
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