+ Reply to Thread
Results 1 to 2 of 2

Closing Another Workbook With VBA

  1. #1
    Valued Forum Contributor
    Join Date
    09-23-2005
    Location
    Bristol, UK
    MS-Off Ver
    2007
    Posts
    664

    Closing Another Workbook With VBA

    Hi all,

    I have a piece of VBA that opens up another workbook when the user opens a document (this is due to using INDIRECT formulae). I'd like for this second workbook to also close when the 'parent' workbook is closed. Can anyone suggest a means of doing this?

    FYI - the opening VBA is as follows:

    Please Login or Register  to view this content.
    TIA,

    SamuelT

  2. #2
    Registered User
    Join Date
    09-23-2008
    Location
    London
    Posts
    11
    Hi Samuel,

    OK, two workbooks (BookA.xls and BookB.xls). When BookA is closed you want to force BookB to close (and save changes, for example)

    If you add the following code to ThisWorkbook module in BookA.xls

    Please Login or Register  to view this content.
    Works for me. No doubt you will need to do some other checking etc.

    Hope that helps.

    cheers

    Malcolm

+ 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. Macro moves out of Active WorkBook. Why?
    By ulfah in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-19-2008, 01:14 PM
  2. Closing Workbook without saving Changes
    By Sam I Am in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-10-2008, 08:02 PM
  3. closing only one workbook when multiple open
    By jmark in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-16-2007, 03:08 PM
  4. closing a workbook without saving and closing a workbook with saving enabled
    By stanigator in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-24-2007, 02:15 PM
  5. Can someone explain this macro to me?
    By gav_69 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-29-2007, 06:04 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