In Excel 2016, the following AppleScript:
tell application "Microsoft Excel"
activate
open "Macintosh HD:Users:path:to:file"
end tell
opens a dialog asking the user to grant access
With previous Excel's versions, the file opened immediately.
It seems that Microsoft doesn't allow any more to open a file from a script without the express user permission.
Is there a way to bypass the dialog?
Use a file object or an alias object instead of a string
tell application "Microsoft Excel"
activate
open file "Macintosh HD:Users:path:to:file"
-- or --> open alias "Macintosh HD:Users:path:to:file"
end tell
When you have a POSIX path, you can use this (open POSIX file "..." doesn't work)
tell application "Microsoft Excel"
activate
set my_file to POSIX file "/Users/name/path/to/file"
open my_file
end tell
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With