+ Reply to Thread
Results 1 to 4 of 4

SaveAs box cancel

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-20-2012
    Location
    London,England
    MS-Off Ver
    Excel 2010
    Posts
    184

    SaveAs box cancel

    Hi,

    I have a macro with
    Application.Dialogs(xlDialogSaveAs).Show
    in it

    if the saveAs box is cancelled, it goes to the next line of the sub instead of exiting. what do I need to add in to move to Exit Sub if the Cancel is selected?

    many thanks in advance.

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: SaveAs box cancel

    Hi,

    It returns a Boolean so
    If Application.Dialogs(xlDialogSaveAs).Show = False Then Exit Sub
    or
    If Not Application.Dialogs(xlDialogSaveAs).Show Then Exit Sub
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Forum Contributor
    Join Date
    08-20-2012
    Location
    London,England
    MS-Off Ver
    Excel 2010
    Posts
    184

    Re: SaveAs box cancel

    perfect thanks

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: SaveAs box cancel

    You're welcome. Thanks for the rep.

+ 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. [SOLVED] Intercept the Cancel of SaveAs dialog
    By Tiger20 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-02-2016, 09:03 PM
  2. Cancel SaveAs Produces False.pdf File
    By StudioLETA in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-02-2015, 12:08 PM
  3. [SOLVED] Allow Cancel during SaveAs Dialog, when Filename is Specified
    By FallingDown in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-11-2014, 06:51 AM
  4. cancel Save and SaveAs according to condition
    By hakan439 in forum Word Programming / VBA / Macros
    Replies: 0
    Last Post: 06-27-2011, 08:06 AM
  5. Add Instruction Code For NO or CANCEL within ActiveWorkbook.SaveAs
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-26-2010, 04:20 PM
  6. SaveAs - user pushing cancel corrupts the file
    By slankc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-21-2006, 06:10 PM
  7. How check for No/Cancel Button when SaveAs and file already exists?
    By Joe HM in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-19-2005, 06: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