+ Reply to Thread
Results 1 to 3 of 3

Saveas method fails due to duplicate file name

  1. #1
    Forum Contributor sauerj's Avatar
    Join Date
    11-11-2009
    Location
    Lafayette, IN
    MS-Off Ver
    Excel 2019
    Posts
    163

    Saveas method fails due to duplicate file name

    I'm using saveas method to save new file to new name. But, when a duplicate file name exists, the conflict dialog box appears. Macro does not fail if clicking YES (Ok so far), but it does fail when clicking NO or CANCEL. How do I take what the user clicks and skip the save if user clicks NO or CANCEL, and get the macro to move on w/o failing.

    I tried saving "result" of method to integer variable in hope to "use" that, but that didn't work either (2nd bit of code below).

    What is best way to interpret user's answer and follow suit in the macro code??? Do you turn off errors for this step???

    Please Login or Register  to view this content.
    Last edited by sauerj; 02-21-2014 at 01:01 PM.

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Saveas method fails due to duplicate file name

    If they click no and you just want that to be cancel then I think
    Please Login or Register  to view this content.
    sounds like the easiest solution.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2019
    Posts
    209

    Re: Saveas method fails due to duplicate file name

    Hi Sauerj,

    you can use this code too

    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ 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. Workbook.SaveAs Fails in Office 2010
    By Galaxiom in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-11-2012, 08:58 PM
  2. Method 'SaveAs' fails
    By mtpsuresh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-16-2006, 06:25 AM
  3. SaveAs File Path Method
    By kartune85 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2006, 03:00 AM
  4. Paste method fails in VBA
    By lalu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-13-2005, 11:05 PM
  5. [SOLVED] A little help with SaveAs Method please
    By Stitch45 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-29-2005, 09:07 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