Results 1 to 3 of 3

Thread: Workbook_BeforeClose not working when closing application

  1. #1
    Acolyte rdwray's Avatar
    Join Date
    Mar 2017
    Posts
    28
    Articles
    0
    Excel Version
    2010

    Workbook_BeforeClose not working when closing application



    Register for a FREE account, and/
    or Log in to avoid these ads!

    In Excel 2010 if I use the close workbook "X", Workbook_BeforeClose works, but if I use the application close button, it does not - why?
    Last edited by rdwray; 2019-04-18 at 04:46 PM.

  2. #2
    Acolyte Heyjoe's Avatar
    Join Date
    Jan 2019
    Location
    USA
    Posts
    52
    Articles
    0
    Excel Version
    2019
    Quote Originally Posted by rdwray View Post
    In Excel 2010 if I use the close workbook "X", Workbook_BeforeClose works, but if I use the application close button, it does not - why?
    Rdwray,

    I don't quite understand your question. When you say you are using the application close button, do you mean your code is similar to the following:

    Code:
    Application.ThisWorkbook.Close
    ?

  3. #3
    Acolyte rdwray's Avatar
    Join Date
    Mar 2017
    Posts
    28
    Articles
    0
    Excel Version
    2010
    Quote Originally Posted by Heyjoe View Post
    Rdwray,

    I don't quite understand your question. When you say you are using the application close button, do you mean your code is similar to the following:

    Code:
    Application.ThisWorkbook.Close
    ?
    Maybe I misstated it. There are 2 "X"s, one will close the work book and the other will close the application (Excel). Another thing I did not state is that I am working with Personal.xlsb. I have since found out that it is impossible to do, as soon as you share the workbook, it locks out Workbook_BeforeClose and having Personal.xlsb not shared is useless.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •