Results 1 to 7 of 7

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

Threaded View

  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:

    Private Sub Workbook_BeforeClose(Cancel As Boolean)
        Dim sName As String
        Dim i As Long
        For i = 9 To 13
            sName = sName & Cells(3, i)
        Next i
        ActiveWorkbook.SaveAs Filename:="C:\Test\Release" & sName & ".xlsm", FileFormat:=52
    End Sub
    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.

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. 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. 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