The information in this article applies to:
SUMMARY
You can exit Windows from within Microsoft Excel 5.0, 7.0 and 97 by using a
Visual Basic macro. The procedure below makes a call to a Windows
dynamic-link library (DLL) that is similar to clicking Exit on the File
menu in Program Manager in Windows 3.1, or clicking Shutdown on the Start
menu in Windows 95.
MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web: http://www.microsoft.com/support/supportnet/overview/overview.aspCAUTION: The Declare, Call and Register Functions listed in the following macro are very sensitive. If used incorrectly, these functions may cause a general protection fault (GP Fault) in Windows or cause other software problems. NOTE: The macros shown below will not work on systems running Microsoft Windows NT (all versions). Microsoft Windows NT does not allow applications to control the operating system in the manner described below. These macros will run without error but will have no effect. Note that a line that is preceded by an apostrophe introduces a comment in the code--comments are provided to explain what the code is doing at a particular point in the procedure. Note also that an underscore character (_) indicates that code continues from one line to the next. You can type lines that contain this character as one logical line or you can divide the lines of code and include the line continuation character. For more information about Visual Basic for Applications programming style, see the "Programming Style in This Manual" section in the "Document Conventions" section of the "Visual Basic User's Guide." The following procedures will allow you to exit Windows from Microsoft Excel: Microsoft Excel 7.0, 7.0a, and 97
Microsoft Excel 5.0 and 5.0c
This will cause Windows to close all open applications immediately
and return to MS-DOS.
CAUTION: Any sheets that you are editing in the current instance of Microsoft Excel (the instance from which the macro is run) will be closed without confirmation. You will lose any changes made since the last time these files were saved. Other Windows applications and instances of Microsoft Excel prompt you for confirmation (just as if you had exited Windows manually). REFERENCES
Microsoft Windows SDK Additional query words: 97 8.00 7.00 7.00a 5.00c Sdk dynamic link
Keywords : kbprg kbdta KbVBA |
Last Reviewed: November 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |