Microsoft KB Archive/49273: Difference between revisions
(importing KB archive) |
m (Text replacement - "&" to "&") |
||
Line 20: | Line 20: | ||
<li><p>Trap the error from the OPEN function in the following manner:</p> | <li><p>Trap the error from the OPEN function in the following manner:</p> | ||
<pre> =ERROR(FALSE) | <pre> =ERROR(FALSE) | ||
=IF(ISERROR(OPEN(file)),ALERT("Please locate: "& | =IF(ISERROR(OPEN(file)),ALERT("Please locate: "&file,2)+OPEN?()) | ||
=RETURN()</pre> | =RETURN()</pre> | ||
<p>Using this procedure opens the specified file if it resides in the current directory or, if the document can't be found, an Open Document dialog box appears.</p></li> | <p>Using this procedure opens the specified file if it resides in the current directory or, if the document can't be found, an Open Document dialog box appears.</p></li> | ||
Line 26: | Line 26: | ||
<pre> =ERROR(FALSE)</pre></li></ol> | <pre> =ERROR(FALSE)</pre></li></ol> | ||
=IF(ISERROR(FILE.DELETE(file)),ALERT("locate:"& | =IF(ISERROR(FILE.DELETE(file)),ALERT("locate:"&file,2)+FILE.DELETE?()) | ||
<pre> =RETURN() | <pre> =RETURN() | ||
Latest revision as of 14:14, 21 July 2020
Excel: OPEN and FILE.DELETE Functions Return ErrorLast reviewed: October 31, 1994 |
SUMMARYIn Excel version 2.20, the OPEN and FILE.DELETE functions return an error if the filename is not found in the current directory. A dialog box does not appear as the documentation suggests on pages 217 and 254 of the "Microsoft Excel Functions and Macros" manual. The following are three possible workarounds:
=IF(ISERROR(FILE.DELETE(file)),ALERT("locate:"&file,2)+FILE.DELETE?()) =RETURN() This procedure deletes the specified file if it resides in the current directory or, if the document can't be found, a Delete Document dialog box appears. Note: The OPEN? and FILE.DELETE? functions call the Open Document and Delete Document dialog boxes as if Open or Delete were selected from the File menu. |
KBCategory: kbother Last reviewed: October 31, 1994 |