ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Always prompted to save even when not modified (https://www.excelbanter.com/excel-programming/309134-always-prompted-save-even-when-not-modified.html)

Macca

Always prompted to save even when not modified
 
hi,

I am using Automation with VC++ 6 to create an excel workbook. I then do
some writing to it and save it before closing the workbook.

When i open the excel spreadsheet from windows explorer i can see the
contents fine. The problem i am having is that when i close it, the save as
dialog appears to prompt me if i would like to save any changes i have made,
even though i haven't made any changes.

I would like to be prompted only if changes are made.

I have included some code snippets below. I'd appreciate any help on how to
solve this problem. I have used a lot of code from Knowledge Base Article
179706.

Thanks In Advance.
Macca


// Create a Spreadsheet
COleVariant
covTrue((short)TRUE),
covFalse((short)FALSE),
covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);


_Application app;
Workbooks books;
_Workbook book;

Worksheets sheets;
_Worksheet sheet;
Range range;
Font font;
Range cols;

// Start Excel and get Application object.

if(!app.CreateDispatch("Excel.Application"))
{
AfxMessageBox("Couldn't start Excel and get Application object.");
return;
}


//Get a new workbook.
books = app.GetWorkbooks();
book = books.Add (covOptional);


All times are GMT +1. The time now is 09:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com