Re: Closing a file you left open (error -49)
Re: Closing a file you left open (error -49)
- Subject: Re: Closing a file you left open (error -49)
- From: Luther Fuller <email@hidden>
- Date: Tue, 19 Apr 2011 14:06:52 -0500
On Apr 19, 2011, at 1:15 PM, Ruffin Bailey wrote: I've been trying to save out the contents of an Excel page to a specially formatted text file by iterating through its cells, and occasionally while I'm learning I run into an error, bust out of the script, and end up leaving a file open.
I always create/open a text file like this ...
try close access file reportPath -- in case file is already open end try try open for access file reportPath with write permission set fileRefNr to the result set eof fileRefNr to 0 on error errText number errNr "Error = " & errNr & return & errText display dialog the result end try
and I don't have those problems. If the file does not exist or is already closed, the first 'try' block hides the error. The second 'try' block creates the file, if necessary, then opens it.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden