none
Excel Sheet change event RRS feed

  • Question

  • Hi,

    In my Excel Addin Project, i have wired SheetChange event like this. this line of code is added in MyExcelAddIn_Startup event.

    this.Application.SheetChange += new AppEvents_SheetChangeEventHandler(Application_SheetChange);

    above event handler is executed whenever i write anything in the cell and hit enter or Tab. but it s not executed if i change the font size in cell or make it bold. I want to set a flag if anything is changed in the entire excel workbook in any sheet.

    i also tried other event as below.

    ActiveSheet.Change += new Microsoft.Office.Interop.Excel.DocEvents_ChangeEventHandler(LobjActiveSheet_Change);

    this is also same like first one. Is there a way to find out if anything is changed in the entire excel after it is opened.

    Thanks,

    Chirag

                          

    Wednesday, June 6, 2012 6:50 PM

Answers

  • Hi CHirag,

         As fa as I Know, there is no event handler excuting while you change the font size in cell or make it bold in a Worksheet.

         However, I would suggest you use the Workbook.Saved Property to find out if anything changed in excel.This property gets or sets a value that indicates whether no changes have been made to the workbook since it was last saved. The value of Saved property is ture after the  workbook is opened and converts to be false if anything has been changed(inculding  change the font szie,etc).In a word, I recommannd you can determine whether your entire excel has been changed via the value of Saved porperty of  workbook.

        Hope this can help you.

    Regard,

    Leo 

    Thursday, June 7, 2012 6:26 AM

All replies

  • Hi CHirag,

         As fa as I Know, there is no event handler excuting while you change the font size in cell or make it bold in a Worksheet.

         However, I would suggest you use the Workbook.Saved Property to find out if anything changed in excel.This property gets or sets a value that indicates whether no changes have been made to the workbook since it was last saved. The value of Saved property is ture after the  workbook is opened and converts to be false if anything has been changed(inculding  change the font szie,etc).In a word, I recommannd you can determine whether your entire excel has been changed via the value of Saved porperty of  workbook.

        Hope this can help you.

    Regard,

    Leo 

    Thursday, June 7, 2012 6:26 AM
  • Hi Leo,

    Thanks for the reply. your answer is very much correct and that is the only approach i took. but see my other post: Workbook Saved property needs to be reset

    due to the issue mentioned in the post, i was thinking this work aorund. Workbook.saved property is false in Application_DocumentBeforeClose event after document is opened completely. it is because i am loading small icons in cells while opening the document.

    Thanks,

    Chirag

    Thursday, June 7, 2012 2:00 PM