• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Excel save as overwrites instead of saving with different filename?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Excel save as overwrites instead of saving with different filename?


  • Subject: Excel save as overwrites instead of saving with different filename?
  • From: Nathan Bailey <email@hidden>
  • Date: Wed, 13 Nov 2013 19:51:31 +1100

I have a script (running from osascript) that opens an existing spreadsheet, changes some values and saves it to a new filename.

However, I can't get it to save properly. If I use a string, it will save to a new filename, but if I use a posix path, it saves over the top of the existing file!

Per the below, if I change "outputFile" to "newPathString", it will happily save with as ":Users:foo:bar:out-11.xls", ie. a file with those chars in current directory.

Am I missing some nuance here? It's particularly odd since the open inputFile bit works fine...

thanks!
Nathan

#!/bin/sh
osascript <<DONE
set oldPathString to "/Users/foo/bar/" & "in-$month.xls"
set newPathString to "/Users/foo/bar/" & "out-$month.xls"
set inputFile to posix file oldPathString
set outputFile to posix file newPathString 
tell application "Microsoft Excel"
   open inputFile
   tell worksheet "Sheet1" of active workbook
      -- change values
   end tell
   tell active workbook
      save workbook as filename outputFile
   end tell
end tell
DONE

 _______________________________________________
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

  • Follow-Ups:
    • Re: Excel save as overwrites instead of saving with different filename?
      • From: Shane Stanley <email@hidden>
    • Re: Excel save as overwrites instead of saving with different filename?
      • From: Nathan Bailey <email@hidden>
  • Prev by Date: Re: Mavericks: Long lag making new events in Calendar app
  • Next by Date: Re: Excel save as overwrites instead of saving with different filename?
  • Previous by thread: Re: Mavericks: Long lag making new events in Calendar app
  • Next by thread: Re: Excel save as overwrites instead of saving with different filename?
  • Index(es):
    • Date
    • Thread