Excel: Auto Save Add-In Macro Halts If No Files Are Open

Last reviewed: September 2, 1997
Article ID: Q76256

The information in this article applies to:
  • Microsoft Excel for Windows, versions 3.0, 4.0
  • Microsoft Excel for the Macintosh, versions 3.0, 4.0

SUMMARY

In Microsoft Excel for the Macintosh version 3.0, the Auto Save add-in macro included in the Microsoft Excel Library periodically saves all open files. You can activate the macro by opening Auto Save from the Macro Library folder. Auto Save functions correctly unless it attempts to save when there are no files open. In that case, the macro halts.

You can avoid this problem by modifying the add-in macro with the following steps:

  1. From the File menu, choose Open and select Auto Save.

  2. Hold down the SHIFT key while choosing Open.

  3. From the Window menu, choose Unhide.

  4. Select Auto Save and choose the OK button.

  5. Select row 91 and from the Edit menu, choose Insert.

  6. Click cell B91 and type the following formula:

    =IF(ISERROR(DOCUMENTS(1)),GOTO(B102))

  7. From the File menu, select Save.

MORE INFORMATION

The error occurs because the Auto Save add-in macro does not check to see if any files are open before attempting to save all files. Adding the line above forces Excel to attempt to get a list of currently open files with the DOCUMENTS(1) function and cancels the macro if there are no files open.

REFERENCES

"Microsoft Excel User's Guide 2," version 4.0, pages 195-202 "Microsoft Excel User's Guide," version 3.0 for the Macintosh, Appendix B


Additional query words: 3.0 3.00 4.0 4.00
Keywords : PgmHowTo PgmOthr


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 2, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.