+ Reply to Thread
Results 1 to 4 of 4

Macro to close two workbook

  1. #1
    Forum Contributor
    Join Date
    08-04-2008
    Location
    West Calder, Scotland
    MS-Off Ver
    365
    Posts
    418

    Macro to close two workbook

    Good afternoon all

    I have two workbooks,,,, 'Driver Database' (DD) and 'Driver Standard Routes' (DSR)..

    In the userform on the DD i have a command button to close the userform and open the DSR Sheet... this works OK...

    On the DSR I have command button to clost the DSR, this works OK,, but I also need it to close the DD sheet... I have been trying various version of the code, including switching the two lines around,, but cannot get it to close the DD sheet

    Any help would be very much appreciated

    Many thanks JT

    Please Login or Register  to view this content.
    Last edited by JamesT1; 04-23-2019 at 11:19 AM. Reason: Update

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Macro to close two workbook

    Hi there,

    Knee-jerk (and untested!) suggestion, try:

    Please Login or Register  to view this content.
    You don't need to explicitly unload the UserForm - this will happen automatically when the workbook is closed.


    Hope this helps,

    Regards,

    Greg M

  3. #3
    Forum Contributor
    Join Date
    08-04-2008
    Location
    West Calder, Scotland
    MS-Off Ver
    365
    Posts
    418

    Re: Macro to close two workbook

    Thanks Greg M

    That closed the DD workbook but not the DSR,, and many thanks for the tip on the Userform

    JT

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Macro to close two workbook

    Hi again,

    Ok, another (again untested!) suggestion:

    Please Login or Register  to view this content.
    And include the following code in a standard VBA CodeModule:

    Please Login or Register  to view this content.

    If this doesn't work I'm going to need to see a copy of your workbook so that I can understand exactly what should be happening.

    As before, please let me know how you get on.

    Regards,

    Greg M

+ 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. Copy from first workbook, close open new workbook paste close
    By johncarr1952 in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 08-04-2021, 08:50 AM
  2. Macro VBA Excel : save and close a workbook from another workbook macro
    By estelleh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-17-2019, 07:09 AM
  3. [SOLVED] Macro to close all workbooks except active workbook and one other named workbook
    By picton2000 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-01-2017, 06:03 PM
  4. [SOLVED] Issue with Open, copy, close Macro - when trying to close workbook Clipboard error
    By seanpcorbett1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-13-2016, 05:14 PM
  5. Macro to close workbook and replace with new workbook
    By chinaboy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-24-2012, 09:05 PM
  6. 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