+ Reply to Thread
Results 1 to 5 of 5

Stop original workbook from closing

  1. #1
    Registered User
    Join Date
    07-29-2009
    Location
    Ireland
    MS-Off Ver
    Excel 365
    Posts
    54

    Stop original workbook from closing

    Hi,

    i have a script below which exports sheet1 to csv file. is there a way to stop the original workbook from closing. as it closes the original workbook and leaves the exported one open. i would like to close the export and still edit the original workbook.

    current script.

    HTML Code: 
    many thanks,

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Stop original workbook from closing

    You're using SaveAs, which effectively turns the current work book into the one you're saving, rather than actually closing the original one.
    Try using SaveCopyAs instead.

    BSB

  3. #3
    Registered User
    Join Date
    07-29-2009
    Location
    Ireland
    MS-Off Ver
    Excel 365
    Posts
    54

    Re: Stop original workbook from closing

    Thanks,

    i have tested that, but it copies the entire workbook i'm only looking to copy sheet1.

    i renamed to below as you suggested.

    HTML Code: 
    i removed FileFormat:=xlCSV from the end as it would return an error if lett in.

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Stop original workbook from closing

    Maybe this will help.
    Please Login or Register  to view this content.
    BSB

  5. #5
    Registered User
    Join Date
    07-29-2009
    Location
    Ireland
    MS-Off Ver
    Excel 365
    Posts
    54

    Re: Stop original workbook from closing

    Thank you, that works a treat, i just need to alter it to select the folder i want to save to, and only copy from row three.

    many thanks again.

+ 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. Will this Macro stop all Macros from running when closing the Workbook?
    By JJFletcher in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-23-2022, 01:42 AM
  2. Workbook Before Close Event - How to stop from Closing?
    By DCSwearingen in forum Excel General
    Replies: 2
    Last Post: 09-03-2006, 06:41 PM
  3. Stop the workbook from closing in Auto_Close
    By gp133 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-02-2006, 05:25 AM
  4. [SOLVED] STOP WORKBOOK CLOSING
    By KandK in forum Excel General
    Replies: 2
    Last Post: 05-05-2006, 04:45 AM
  5. Validation to stop workbook closing
    By Jonathan in forum Excel General
    Replies: 2
    Last Post: 03-31-2006, 06:40 AM
  6. [SOLVED] Stop Workbook from closing.
    By beauty_bobaloo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-23-2006, 08:50 AM
  7. Stop all macros when closing a workbook?
    By L2B in forum Excel General
    Replies: 1
    Last Post: 05-10-2005, 12:22 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