none
Workbook Saved property needs to be reset RRS feed

  • Question

  • Hi,

    In my Excel Addin, i have a functionality to load the small icons in the excel in specific cells. it is implemented using cell names. first we read the excel file content from Database, explode it to temporary location with new excel instance and then put the icons wherever required.

    the issue is, once excel is opened successfully with icons and if i close the document without any change then workbook object saved property is always false. it means something is changed and document need to be saved. if no icons were loaded while opening the excel then it works fine. Workbook object Saved properoty is true in this case which is correct.

    Icons are loaded using, ControlsCollection.AddNamedRange(objRange, "cell_name"); and ControlsCollection.AddControl(objUserControl, objRange, strControlName);

    while opening the excel, last event which is executed is Application_WorkbookActivate after Application_WorkbookOpen. icons are loaded completely in WOrkbookOpen event. In Activate event(in last line) i can see the Workbook Saved property value is true. means no changes. something is making Saved property false in this case after Activate event.

    THanks,

    Chirag

    Wednesday, June 6, 2012 7:12 PM

All replies

  • Hi Chirag,

    In you issue you subscribe the Application_WorbookActivate event and load icons form this event. Is it right? It means that you icons will load when WorkbookActivate event has been fired. So Excel will judge that you changed the document when the workbook has been actived.

    Have a good day,

    T.X.

    Thursday, June 7, 2012 5:56 AM
  • Hi T.X.

    Thanks for the reply. Actually loading icons code is inside Application_Workbookopen event. icon loading is completed in this event. after that Application_WorkbookActivate event if executed. in this event, in the last line, workbook.save property value is true. means document is opened, icons are loaded and document is saved. now if i just click close of the document and verify the workbook.save property then it is false. means something has happened after activate event due to icons loading and it has made the document dirty.

    Thanks,

    Chirag

    Thursday, June 7, 2012 1:49 PM