+ Reply to Thread
Results 1 to 6 of 6

VBA Save Code Intermittment Hanging

  1. #1
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    VBA Save Code Intermittment Hanging

    Hi, I wonder whether someone may be able to help me please.

    I'm using the code below to perform the following:

    • Loop through a specifc set of sheets in my workbook,
    • Copy them,
    • Then create a new workbook, pasting the saved sheet into this, then
    • Save the file into a specific folder.

    Please Login or Register  to view this content.
    The code works, but every so often the code hangs with a pop up box saying that it is saving the file, highlighting the correct location with the only option of removing the pop uop box via a 'Cancel' button.

    When I do press 'Cancel' the code moves onto the next sheet, but does save the file, but it's a little time consuming to continue having to use the 'Cancel' button.

    I didn't have a problem with this when running the code in a Windows XP and Excel 2003 environment, but I've now moved to windows 7 and Excel 2013.

    I just wondered whether someone may be able to look at this please and offer some guidance on how I may overcome this.

    Many thanks and kind regards

    Chris
    Last edited by hobbiton73; 10-07-2014 at 07:05 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA Save Code Intermittment Hanging

    Hi Chris,

    Is it perhaps halting because the file name you're saving is already present?

    Try adding the
    Application.DisplayAlerts = False

    instruction before the loop start.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Save Code Intermittment Hanging

    Hi Richard Buttery, thank you for taking the time to reply to my post and for the suggested amendment which works great.

    All the best and kind regards

    Chris

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA Save Code Intermittment Hanging

    Hi Chris,

    My pleasure and thanks for the rep.

    I had assumed of course that you did indeed want to overwrite the existing file if it exists. If you don't then you'll need to build in some code to move on to the next For instance and exit the loop early before the Save.

  5. #5
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Save Code Intermittment Hanging

    Hi Richard Buttery, thank you for coming back to me. If you're talking about replacing the newly created file with one of the same name which may exist in the 'Save' location, then the overwrite isn't an issue because any exisiting files in the 'Destination' folder are deleted via the 'Kill' lines I have in my code.

    Kind Regards

    Chris

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA Save Code Intermittment Hanging

    Quote Originally Posted by hobbiton73 View Post
    Hi Richard Buttery, thank you for coming back to me. If you're talking about replacing the newly created file with one of the same name which may exist in the 'Save' location, then the overwrite isn't an issue because any exisiting files in the 'Destination' folder are deleted via the 'Kill' lines I have in my code.

    Kind Regards

    Chris
    Good point Chris. One which I had missed.

+ 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. Win 7 Office 2010 save as hanging
    By nathansav in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-26-2014, 04:56 AM
  2. Code, that disables save, save as and close commands
    By mgmetev in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-02-2009, 06:31 PM
  3. Line of code hanging up on one machine???
    By Don G - ExcelForums.com in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-21-2005, 06:06 PM
  4. charting code hanging up
    By Papa Jonah in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-03-2005, 01:06 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