Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Applications / Excel / February 2005



Tip: Looking for answers? Try searching our database.

Applescript Overwrite is Excel X

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
salty_sohal@yahoo.com - 23 Feb 2005 08:49 GMT
I'm trying to automate the conversion of several hundred files and each
one prompts me to overwite... how can I get around this in excel X. My
current line looks like this...

Save ActiveWorkbook In outFile As xlNormal without ReadOnlyRecommended
and CreateBackup

Thanks
Bob Greenblatt - 23 Feb 2005 13:43 GMT
On 2/23/05 3:49 AM, in article
1109148541.629650.167750@o13g2000cwo.googlegroups.com,

> I'm trying to automate the conversion of several hundred files and each
> one prompts me to overwite... how can I get around this in excel X. My
[quoted text clipped - 4 lines]
>
> Thanks

I'm not sure what the applescript text is, but to get excel to bypass the
overwrite warning (and do the overwrite anyway), in VBA the text is:
application.displayalerts=false

Signature

Bob Greenblatt [MVP], Macintosh
bobgreenblattATmsnDOTcom

Salty - 23 Feb 2005 18:59 GMT
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.

Jonathan
Paul Berkowitz - 24 Feb 2005 21:30 GMT
On 2/23/05 10:59 AM, in article
1109185195.913328.208580@z14g2000cwz.googlegroups.com, "Salty"
<salty_sohal@yahoo.com> wrote:

> 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:Desktop:My Sheet.xls"
set tempPath to "Mac HD:Users:me:Desktop: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:Desktop:
   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:Desktop:
   set name of alias tempPath  to "My Sheet.xls"
end tell

Signature

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.

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.