Friday, December 15, 2017

#1 2015-08-09 07:42:09 pm

hiconcepts
Member
Registered: 2012-09-29
Posts: 9

Excel save workbook

I have looked at 10 different resources and can't get any versions to work.  Here is my script. I get an error message saying Applescript can't interpret the save command.  Any ideas?  Everything else works fine.

tell application "Microsoft Excel"
    set theWorkbookFile to choose file with prompt "Please select an Excel workbook file:"
    set newfile to "FMNewCase.csv"
end tell
tell application "Microsoft Excel"
    open theWorkbookFile
    set myColumn to range "W:AF"
    delete myColumn
   
    set myColumn to range "O:Q"
    delete myColumn
   
    save workbook as filename newfile
end tell


Filed under: Excel save command

Offline

 

#2 2015-08-09 11:28:52 pm

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11482
Website

Re: Excel save workbook

Hi,

please post OS X related questions into the AppleScript | OS X forum.
Code Exchange is for sharing working solutions.

Try this

Applescript:


set theWorkbookFile to choose file with prompt "Please select an Excel workbook file:"
tell application "System Events" to set destinationFolder to path of container of theWorkbookFile
set newfile to destinationFolder & "FMNewCase.csv"

tell application "Microsoft Excel"
   set sourceBook to open workbook workbook file name (theWorkbookFile as text)
   set myColumn to range "W:AF"
   delete myColumn
   
   set myColumn to range "O:Q"
   delete myColumn
   
   save sourceBook as CSV file format in newfile
end tell


regards

Stefan

Offline

 

#3 2015-08-10 01:07:17 pm

hiconcepts
Member
Registered: 2012-09-29
Posts: 9

Re: Excel save workbook

stefan:

Thank you…it is working.  And since I am new to this, in the future I will post questions in the forum you recommended.  When I first looked at the alternatives, I thought that forum only dealt with OSX related scripts.

Herb

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)