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

Hi,

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

Try this


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


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