View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Macca Macca is offline
external usenet poster
 
Posts: 3
Default 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);