SAVE.AS Returns Error if Replacing Existing? Dialog CanceledLast reviewed: November 2, 1994Article ID: Q65905 |
SUMMARYIf you call the SAVE.AS function from a macro, you will receive a macro error if the Replace Existing? dialog box is canceled. This dialog warns you that the filename being used already exists in the active directory. This problem was corrected in Microsoft Excel version 3.0.
MORE INFORMATION
Solution in Excel 2.xThe only way to eliminate this error, is to write a custom SAVE.AS function that checks whether the file exists, and deletes the file if it does. The following macro does this:
A1: =INPUT("Save file as: (Ex.: Sheet1.XLS)",2,,GET.WINDOW(1)) A2: =IF(A1,,RETURN()) A3: =FILES(A1) A4: =IF(ISERROR(A3),SAVE.AS(A1),GOTO(A6)) A5: =RETURN() A6: =ALERT("File already exists. Overwrite it?",1) A7: =IF(A6,FILE.DELETE(A1),GOTO(A1)) A8: =SAVE.AS(A1) A9: =RETURN() |
KBCategory: kbother
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |