Results 1 to 6 of 6

Allow Cancel during SaveAs Dialog, when Filename is Specified

Threaded View

  1. #1
    Forum Contributor
    Join Date
    12-19-2011
    Location
    Central Europe
    MS-Off Ver
    Excel O365
    Posts
    364

    Allow Cancel during SaveAs Dialog, when Filename is Specified

    Hi all

    I am using this code

    Sub SaveFile()
    Dim SaveName1 As String
    
    
    SaveName1 = Range("D3").Value & " " & Range("F3").Value & " " & Range("C12").Value & " " & Date
    
    ChDrive "G"
    ChDir "G:\Folder1\Folder2\Folder2a\Folder2b"
    
    FilePath = Application.GetSaveAsFilename(SaveName1, filefilter:="Excel 93-2007 Workbook(*.xls), *.xls")
    ActiveWorkbook.SaveAs Filename:=Left(FilePath, InStrRev(FilePath, "\")) & SaveName1 & ".xls", FileFormat:=xlNormal
    
    end sub
    It is generating the file name, based on a combination of values in different cells.

    What I would like is the user to be able to acutally cancel the save process.
    With the code above the file will be saved, even if the user clicks the cancel button.

    Thanks for your help in advance

    FD
    Last edited by FallingDown; 04-11-2014 at 06:51 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Window 7 - Excel 2010 setting? VBA ActiveSheet.SaveAs Filename not posting name to dialog
    By portews in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2013, 03:16 PM
  2. 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
  3. 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
  4. 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
  5. [SOLVED] 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