none
beforeclose not in event drop-down list RRS feed

  • Question

  • Hello everyone,

    I'm fairly new to the excel macro and VBA scene. The problem I'm encountering is that I am not seeing the "BeforeClose" as an option to select from the Even drop-down list in VBA. I see "BeforeDelete", "BeforeDoubleClick" and "BeforeRightClick". Did Microsoft remove the "BeforeClose" functionality? 

    Thanks,

    George

    Friday, August 26, 2016 11:46 AM

Answers

  • BeforeDelete, BeforeDoubleClick and BeforeRightClick are events of the Worksheet object. For example, BeforeDelete occurs when you start to delete a worksheet.

    BeforeClose is an event of the Workbook object. It occurs when you start to close the workbook.

    It is not possible to "close" a worksheet, so there is no BeforeClose event of the Worksheet object.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Friday, August 26, 2016 12:30 PM

All replies

  • BeforeDelete, BeforeDoubleClick and BeforeRightClick are events of the Worksheet object. For example, BeforeDelete occurs when you start to delete a worksheet.

    BeforeClose is an event of the Workbook object. It occurs when you start to close the workbook.

    It is not possible to "close" a worksheet, so there is no BeforeClose event of the Worksheet object.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Friday, August 26, 2016 12:30 PM
  • Hi there,  I am having the same problem.  Did you ever get a solution to this problem?  I do not have that option either and all the message I find online tells me to select the "BeforeClose".  How did you resolve your issue?  
    Monday, October 21, 2019 4:26 PM
  • BeforeClose is an event of the workbook. You have to create the event handler in the ThisWorkbook module. Select Workbook from the first dropdown at the top of the module window, and scroll up the list of the second dropdown to select BeforeClose.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Monday, October 21, 2019 9:59 PM