+ Reply to Thread
Results 1 to 3 of 3

Activate workbook before close event when excel is closed

  1. #1
    Registered User
    Join Date
    08-16-2007
    Location
    Portsmouth, UK
    Posts
    86

    Activate workbook before close event when excel is closed

    Hi I have a workbook_beforeclose event, which searched for cells highlighted orange and then displays a userform giving the user options.

    The code works fine, if I close the workbook itself. However if I have several workbooks open and I close the whole of Excel and the workbook is not the currently active workbook the code doesn't trigger. Is there a way to ensure that the workbook_beforeclose event code will always run?

    i hope that makes sense, if not let me know and I'll try and explain again. Also if you want to see the code I can provide it, but I don't think its that necessary at the moment, as the problem is not with the code itself just the execution thereof

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good afternoon RobynC

    I can't replicate this problem I'm afraid.
    I set up two test files, check1.xls and check2.xls. Check1.xls has a before close event macro that displays a msgbox. If I open both files and give focus to check2.xls, and then click on the red X to close, the event fires, the msgbox is displayed and then Excel closes.

    Am I missing something? I am using Excel 2003 SP2, Windows XP Pro SP2.

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Registered User
    Join Date
    08-16-2007
    Location
    Portsmouth, UK
    Posts
    86
    Hmm, that's interesting. I'm fairly certain there's nothing special about it. But I shall have another look at some point today and get back to you. There may be a slight delay in responce as I think I'm expected to be in meetings.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1