I added "without displayalerts" to the line and it accepts it as a
valid parameter, but I still get prompted to save.
Thanks for the suggestion though.
It's not a valid parameter: the 'without' is OK but the 'displayalerts' is
being parsed as a variable. That won't create a syntax error but it will
create a run-time error since it's an undefined variable. If the parameter
doesn't exist in the AppleScript dictionary, it doesn't exist.
There's no equivalent of "without displayalerts" in AppleScript for the Save
command (nor in the 2004 dictionary either). This is really an OS check -
there's no app where you can save over another file by AppleScript without
the dialogs. The way to do it is to save to another file name, then delete
or rm the original file, then change the file name to the original file
name in the Finder. The Finder occasionally gets a bit behindhand in these
operations so you should update the containing folder.
set outfilePath to "Mac HD:Users:me
esktop:My Sheet.xls"
set tempPath to "Mac HD:Users:me
esktop:temp.xls"
tell app "Microsoft Excel"
Save ActiveWorkbook In tempPath As xlNormal without ReadOnlyRecommended
and CreateBackup
end tell
tell app "Finder"
delete alias outfilePath
update alias "Mac HD:Users:me
esktop:
set name of alias tempPath to "My Sheet.xls"
end tell
Instead of delete in the Finder (which puts the original in the trash) you
might prefer to:
set posixOutPath to quoted form of POSIX path of outfilePath
do shell script "rm " & posixOutPath
tell app "Finder"
update alias "Mac HD:Users:me
esktop:
set name of alias tempPath to "My Sheet.xls"
end tell
--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <
http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <
http://macscripter.net/scriptbuilders/>
Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.
PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.