Microsoft KB Archive/818657

= Excel SaveAs Method Does Not Set Saved Property for .txt or .csv Files =

Article ID: 818657

Article Last Modified on 5/12/2007

-

APPLIES TO


 * Microsoft Office Excel 2007
 * Microsoft Office Excel 2003
 * Microsoft Excel 2002 Standard Edition
 * Microsoft Excel 2000 Standard Edition
 * Microsoft Excel 97 Standard Edition

-



SYMPTOMS
When you use the programmatic SaveAs method in Microsoft Excel to save a new workbook or an existing workbook as either a tab delimited (*.txt) or a comma delimited (*.csv) text file, Excel does not set the Saved property to True on a successful save. Therefore, when you close a workbook, you may be prompted to save changes. This problem occurs even though the data was saved as plain text. You are prompted with the following message:

Do you want to save changes to '[bookname]'?



CAUSE
Excel workbooks contain a lot of data. The data includes styles, formats, formulas, cell spacing, and active selection. This data cannot be persisted in a plain text file. Only the native Excel formats (*.xls or *.xla) or HTML formats (*.htm or *.mht) can perform a full save on a workbook. If you save a new workbook or an existing workbook as a .txt or .csv text file, then changes remain that are associated to that workbook that cannot be saved with the SaveAs operation. Therefore, Excel does not change the Saved flag for the workbook, and you are prompted when you try to close the file.



STATUS
This behavior is by design. Excel always prompts you about unsaved changes to a file when you try to close the file. If you want to avoid this prompt, set the Saved property to True in your code.

Additional query words: xl2003

Keywords: kbnofix kbprb KB818657

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.