Close CSV File in Microsoft Excel - Saving no???

I have a big script I just finished that takes data from Portfolio and imports it to Excel, manipulating it and all that jazz to go on our website. The spreadsheet is created fine, but I have to save it in Windows CSV format, which is where things get really tricky.

See, Microsoft Excel somehow doesn’t believe you’ve actually saved a document when you save it as Windows CSV. In fact, without Applescript, if you save a CSV file, and then quit, it will ask you if you want to save changes, as if you actually changed something. Total idiocy.

So, on the applescript side of things, after I save the CSV file with:

set OutFilename to ((outputFolder & ffName & ".csv") as string)
		Save ActiveWorkbook In OutFilename As xlCSVWindows without CreateBackup

it creates the CSV file I want, but then when I go to run this command:

close ActiveWorkbook

of course, it asks again if I would like to save the file. This I expected, so I added “saving no” to the end to bypass the redundant save dialog:

close ActiveWorkbook saving no

BUT (and this is the important part), this does NOT tell Excel not to save the file. As a matter of fact, this seems to tell Microsoft to save the file, because Excel then brings up a dialog asking where to save it. Absolute insanity. If you tell it nothing, it asks. But if you tell it no, it thinks yes. If you say saving yes, it does the same thing. How exactly do I tell Excel NOT to save the file AGAIN?

This is v.X on 10.3.9.

Thanks!


Steve

Hmmm… that’s mighty annoying. That saving no part is intended to do exactly what you think it should.

If they’re going to insist that a file hasn’t been saved until it’s been saved as an Excel doc, go ahead and save it as an Excel doc after you’ve saved out the CSV version. You can save it to the user’s temp directory so it will get deleted automatically, or save it and then tell finder to delete it.

Dumb, but it’s the only work-around I can think of.

Are there any service packs/updaters for v.X that you don’t have installed? Can you upgrade to 2003 or 4? Maybe the equivelent vba command will work?

You know, I thought the same thing and I started to try that yesterday, but then it was time to wrap up - I know at first glance it didn’t appear to work, but I should really spend more time on it. I’ll post again if it doesn’t work…

Thanks!

Steve

I know I’m late to this thread but this worked for me:

tell application "Microsoft Excel"
	activate
	close active workbook without saving
end tell