Wednesday, October 17, 2018

#1 2018-10-11 04:01:19 pm

Donatelo
Member
Registered: 2018-04-06
Posts: 4

Excel will not create a file but will overwrite a file

Hi I am new to apple script and am having a bit of a problem saving a file.
My script below doesn't seem to create a new file with the correct name but it will over write a file if it already exists.
If someone was able to point out what I am doing wrong I would greatly appreciate it.
This has been making me crazy all day.
Thank you very much

Applescript:

tell application "Microsoft Excel"
   set theWorkbookFile to "Macintosh HD:Osascript_ForExcel_Shapes:Working:Customer_Campaign_QR_0328.xlsx"
   open theWorkbookFile #open the xls file
   set theWorksheetname to name of worksheet 1 of active workbook
   set theWorksheet to worksheet 1 of active workbook
   set theFile to "Macintosh HD:Osascript_ForExcel_Shapes:Working:Customer_Campaign_QR_0328.csv"
   save as theWorksheet filename theFile file format CSV file format with overwrite #save the file in csv format and overwrite if it exist
end tell


Filed under: excel, saving, overwriting

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)