Microsoft KB Archive/173113

= XL97: Prompt to Save Changed Workbook Fails to Appear =

Article ID: 173113

Article Last Modified on 11/23/2006

-

APPLIES TO


 * Microsoft Excel 97 Standard Edition

-



This article was previously published under Q173113



SYMPTOMS
When you change and then close a workbook in Microsoft Excel 97, you are not prompted to save the changes.



CAUSE
This problem may occur if both of the following conditions are true:


 * You run a macro that changes the caption of the workbook window. -and-


 * You try to close the workbook without first saving the changes.



RESOLUTION
To resolve this problem, do either of the following:


 * Click Save on the File menu before you click Close on the File menu or click the Close button (the box with the "X" in it) at the upper-right corner of the workbook window. -or-


 * Add a line of Microsoft Visual Basic for Applications code in the macro to set the Saved property to False after the line that sets the Caption property of the workbook window.

Microsoft 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 a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:

https://partner.microsoft.com/global/30000104

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

The sample macro in following example prompts you to save the workbook. To use the macro, follow these steps:

 Start Microsoft Excel and create a new workbook. Press ALT+F11 to open the Visual Basic Editor. On the Insert menu, click Module.  Type the following into the new module: Sub Caption_Macro

'           'More code here. '

'Changes the Caption property of the first window Windows(1).Caption = "Window 1"

'Setting that the workbook has changed. ActiveWorkbook.Saved = False

'           'More code here. '

End Sub  Switch to Microsoft Excel (press ALT+F11). On the Tools menu, point to Macro, and click Macros. Then, click Caption_macro and click Run.</li> On the File menu, click Close.</li></ol>

You receive a message that prompts you to save the workbook.

<div class="status_section">

STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

<div class="moreinformation_section">

MORE INFORMATION
In most cases, if you attempt to close a changed workbook that you have not saved, you are prompted to save the changes. To retain changes you want to keep, save them before you close the workbook.

The Saved property returns a True or False value depending on whether changes have been made to the workbook. Note that it is possible to set the Saved property to True or False.

<div class="references_section">