+ Reply to Thread
Results 1 to 7 of 7

Auto save as VBA code causes Debugger prompt if I don't want to replace file

  1. #1
    Forum Contributor
    Join Date
    05-09-2017
    Location
    NC
    MS-Off Ver
    2013
    Posts
    103

    Auto save as VBA code causes Debugger prompt if I don't want to replace file

    Mumps1 was kind enough to help me with a code from another thread that worked great for what I needed but an unforeseen issue popped up that may can be fixed with another line or code or I may have to simply train operators on the debugger. Here is the code he did for me:

    Please Login or Register  to view this content.
    What this does is when an employee closes out this sheet it will make a copy in C:\Test folder named Release xxxxx (the xxxxx comes from a range of cells within the sheet). The code works perfectly for me and the reason for the code was for employees who are not comfortable with computers. However if I go to look at a file for whatever reason, upon closing it will say that file already exists and would I like to replace the current copy. That is great because it prevents people from forgetting to change the series number or things like that but they are times when I would open a file and not make changes or have to open a file and plug in some "what if" numbers and then close it not saving any changes and if I select that I do not want to replace the current version it then goes into debug mode.

    So...long story short, can a line of code be added to this that does not send it into debugg mode if I chose not to replace my current copy? Hopefully I wasn't too confusing.
    Last edited by Stryfe; 02-21-2018 at 04:25 PM.

  2. #2
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Auto save as VBA code causes Debugger prompt if I don't want to replace file

    Hi Stryfe- this seems to work:
    Please Login or Register  to view this content.
    Last edited by leelnich; 02-21-2018 at 02:59 PM.
    Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee

  3. #3
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Auto save as VBA code causes Debugger prompt if I don't want to replace file

    Please Login or Register  to view this content.
    This allows the file to go ahead and overwrite the existing file without the alert message appearing. You could also use an If ... Then statement to check if the file already exists and skip the SaveAs statement if True.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,705

    Re: Auto save as VBA code causes Debugger prompt if I don't want to replace file

    @stryfe
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Auto save as VBA code causes Debugger prompt if I don't want to replace file

    Quote Originally Posted by JLGWhiz View Post
    This allows the file to go ahead and overwrite the existing file without the alert message appearing...
    OP states the problem occurs when s/he doesn't want to save. The Save alert isn't the issue.

    PS- OOPS! Sorry Alan, didn't see it.
    Last edited by leelnich; 02-21-2018 at 03:05 PM.

  6. #6
    Forum Contributor
    Join Date
    05-09-2017
    Location
    NC
    MS-Off Ver
    2013
    Posts
    103

    Re: Auto save as VBA code causes Debugger prompt if I don't want to replace file

    Quote Originally Posted by alansidman View Post
    @stryfe
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    My apologies alansidman. I believe the issue is corrected and will not be repeated in the future.

  7. #7
    Forum Contributor
    Join Date
    05-09-2017
    Location
    NC
    MS-Off Ver
    2013
    Posts
    103

    Re: Auto save as VBA code causes Debugger prompt if I don't want to replace file

    Thank you all, I believe leelnich's method works for what we need but I also got some great options for the future as well so thank you very much.

+ 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. Replies: 1
    Last Post: 06-20-2017, 10:28 AM
  2. Auto save Excel file without prompt and create a backup copy
    By GEMINI528 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-27-2014, 12:35 PM
  3. VB code to auto save file as excel 2010
    By bryanc2k in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-14-2010, 01:44 PM
  4. Auto close, save to new file without prompt
    By Bafa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-09-2007, 10:31 AM
  5. [SOLVED] How to skip save prompt ask me if I want to replace File.
    By Viviana in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-15-2006, 10:50 PM
  6. [SOLVED] Save without 'Replace' Prompt
    By mg_sv_r in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-17-2006, 11:50 AM
  7. [SOLVED] Auto rename and save prompt needed.
    By Gizmo63 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-07-2006, 10:10 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