+ Reply to Thread
Results 1 to 5 of 5

Macro to close open files without saving it

  1. #1
    Registered User
    Join Date
    01-02-2014
    Location
    Cape Town
    MS-Off Ver
    Excel 2007
    Posts
    88

    Macro to close open files without saving it

    Require assistance with setting up a macro.

    The macro the way it’s currently setup reads a filename in a cell reference (data extraction worksheet, cell reference b7) and opens that file, copies data back to the main workbook and then opens the next file (data extraction worksheet, cell reference b8). Before the file copy, it unhides a worksheet (where it’s copying from).

    I need assistance with closing the files opened (in cell reference b7 and b8) within the macro, and no need to save.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    03-24-2014
    Location
    England
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    575

    Re: Macro to close open files without saving it

    When you open the workbook assign it to a variable:

    Please Login or Register  to view this content.
    Then, to close the workbook you simply:

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor mohan.r1980's Avatar
    Join Date
    09-18-2010
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2010 (windows7)
    Posts
    729

    Re: Macro to close open files without saving it

    try
    Please Login or Register  to view this content.
    Regards,
    MohanS


    "Perfection is not attainable, but if we chase perfection we can catch excellence." - Vince Lombardi

    You can simply say thanks by clicking "*Add Reputation" icon

  4. #4
    Valued Forum Contributor mohan.r1980's Avatar
    Join Date
    09-18-2010
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2010 (windows7)
    Posts
    729

    Re: Macro to close open files without saving it

    Hi

    i am trying to make easy your code
    try
    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor mohan.r1980's Avatar
    Join Date
    09-18-2010
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2010 (windows7)
    Posts
    729

    Re: Macro to close open files without saving it

    Your welcome and thanks for rep+

+ 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. Open and close files using excel macro
    By laxmanann in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-16-2014, 12:06 PM
  2. [SOLVED] macro to open all files in a folder, save them, then close them
    By hopefulhart in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-27-2013, 06:40 PM
  3. [SOLVED] Macro to open and close all files in a folder and sub folders
    By BillDoor in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-31-2012, 06:51 AM
  4. Macro to open, copy/paste, and close files with variable name
    By mjr33 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-15-2011, 10:20 PM
  5. Macro to Open, Save and Close Excel Files
    By az! in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-07-2011, 04:19 AM
  6. Macro to Open, Print and Close multiple PDF Files
    By Herve_Rob in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-09-2009, 05:08 AM
  7. Macro to open all files, make changes, save and close
    By certain_death in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-20-2009, 03:42 PM

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