+ Reply to Thread
Results 1 to 3 of 3

In Workbook Before Close, workbook save code not running.

  1. #1
    Registered User
    Join Date
    11-01-2013
    Location
    Essex UK
    MS-Off Ver
    Excel 2003
    Posts
    95

    In Workbook Before Close, workbook save code not running.

    I'm Running excel 2003 on windows 10..
    I have an issue with WorkBook Before Close
    In Workbook Before Close I have code to save the workbook.
    This works fine when the workbook is opened and closed from itself.
    However, when another workbook activates the open and close procedure for the other book,
    the save does not work.
    To better understand the problem, I created 2 workbooks, Workbook A and Workbook B.

    Workbook A has the following code:-

    Please Login or Register  to view this content.
    Workbook B has the following code:-


    Please Login or Register  to view this content.
    If I open WB B make changes , say to Sheet 1, then close it, the changes are saved.

    If I do the same, then open WB A, WB B is closed but the changes are not save, though
    Copy to clipboard
    Workbooks("Workbook B.xls").Save
    is run.

    There must be some subtle reason WB B's Workbook Close event in Workbook Before Close doesn't like being called "externally".

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: In Workbook Before Close, workbook save code not running.

    Hello, where would these codes be located?

  3. #3
    Registered User
    Join Date
    11-01-2013
    Location
    Essex UK
    MS-Off Ver
    Excel 2003
    Posts
    95

    Re: In Workbook Before Close, workbook save code not running.

    Sorry - should have added that info.

    For both Workbooks A & B , the Auto_Open and MyClose codes are each in separate standard modules.

    For WorkBook B, the third set of code (containing the save instruction that doesn't run)
    is located in ThisWorkbook, under WorkBook_BeforeClose.

    Hope this is now clearer.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Close and Save after inactivity, workbook keep re-opening, save and close, re-open... etc
    By QcHuldar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2020, 02:51 PM
  2. Save and Close All excel Workbook except Active Workbook
    By ayyappan80 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-11-2020, 09:36 AM
  3. Save workbook, attach it to outlook email, close workbook?
    By Jasonhouse in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-27-2014, 11:52 PM
  4. [SOLVED] Code to cut cell from one workbook, close same workbook, and paste in different workbook
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 30
    Last Post: 03-13-2014, 04:01 PM
  5. Replies: 1
    Last Post: 12-26-2013, 04:55 AM
  6. [SOLVED] Vba code to save and close an workbook on time ??
    By black7 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-18-2013, 02:35 PM
  7. How to open,save and close another workbook from the current workbook using macro?
    By ravikumar00008 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-15-2012, 10:42 AM

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