I had a routine that used to save a CSV file as XLSX now I get a parameter error Excel version V16.88.
This is the code that used to work any suggestions please.
tell application "Finder"
set thefolder to alias "Macintosh HD:Users:petermitchell:Library:CloudStorage:Dropbox:DownloadsSafari:"
open last item of (sort (get files of thefolder) by creation date)
--The file download from the Web is downloaded in CSV format and offers an option to convert
tell application "System Events"
tell process "Microsoft Excel"
delay 2 -- wait for the button to appear
try
click button "Convert" of window 1 -- click the "Don't Convert" button
end try
end tell
end tell
######Rename and Save as XLSX file
set thefolder to "Macintosh HD:Users:petermitchell:Library:CloudStorage:Dropbox:DividendCapture2024:MasterFile:"
-- Get the current date and time as a string
set dateString to time string of (current date)
-- Replace colons with hyphens
set AppleScript's text item delimiters to ":"
set dateItems to text items of dateString
set AppleScript's text item delimiters to "-"
set newDateString to dateItems as string
-- Remove "AM" or "PM"
set TrimedTime to text 1 thru -4 of newDateString -- Remove the last 3 characters (" AM" or " PM")
set FileName to "RawData " & TrimedTime & ".xlsx"
set thefolder to "Macintosh HD:Users:petermitchell:Library:CloudStorage:Dropbox:DividendCapture2024:MasterFile:Processed:"
set destinationPath to thefolder & FileName
tell application "Microsoft Excel"
save workbook as active workbook filename destinationPath file format Excel XML file format
end tell
######
end tell