none
MS Excel BeforeClose event not responding RRS feed

  • Question

  • Hi,

    I've developed an Application which interact with MS Excel. I'm using BeforeClose event to do some work,application is working fine accept it didn't trigger BeforeClose event for the default Work Book e.g. if I open MS Excel, default work book is Book 1 and if i open another work book thru Recent Workbooks then it didn't trigger the event and goes directly to the new Work Book. I want to know is this default behavior of Excel or not ??? I'm using Office 2010.

    thanks and regards.

    Thursday, November 27, 2014 12:31 PM

Answers

  • Hi Wall.E,

    >>if I open MS Excel, default work book is Book 1 and if i open another work book thru Recent Workbooks then it didn't trigger the event and goes directly to the new Work Book. I want to know is this default behavior of Excel or not ??? I'm using Office 2010.<<

    Yes. As far as I test, the Book1 object was not destroyed. We can add an workbook_Open event like to get the numbers of opened workbooks at that time code below:

       void Application_WorkbookOpen(Excel.Workbook Wb)
            {
                MessageBox.Show(Wb.Application.Workbooks.Count.ToString());
                    }

    The number of workbooks we opened is two rathen one.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Wall.E Monday, December 1, 2014 5:37 AM
    Friday, November 28, 2014 6:08 AM
    Moderator

All replies

  • Hello Wall,

    What code do you use for subscribing to the event?

    Did you install the latest updates and service packs for Office 2010?

    Thursday, November 27, 2014 12:53 PM
  • Hi Wall.E,

    >>if I open MS Excel, default work book is Book 1 and if i open another work book thru Recent Workbooks then it didn't trigger the event and goes directly to the new Work Book. I want to know is this default behavior of Excel or not ??? I'm using Office 2010.<<

    Yes. As far as I test, the Book1 object was not destroyed. We can add an workbook_Open event like to get the numbers of opened workbooks at that time code below:

       void Application_WorkbookOpen(Excel.Workbook Wb)
            {
                MessageBox.Show(Wb.Application.Workbooks.Count.ToString());
                    }

    The number of workbooks we opened is two rathen one.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Wall.E Monday, December 1, 2014 5:37 AM
    Friday, November 28, 2014 6:08 AM
    Moderator