Results 1 to 2 of 2

Code for asking for overwrite YES/NO

Threaded View

  1. #1
    Registered User
    Join Date
    05-23-2012
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    2

    Code for asking for overwrite YES/NO

    Hello, i have a print to pdf macro. The macro works fine, but when i want to save a pdf the save as dialog does not prompt me to overwrite or not. Example; When i choose the same folder and same name of document, excel does not ask if i want to overwrite the old pdf with the new.

    What do to?

    
    Sub Make_PDF()
    On Error GoTo Errorhandler
    
    filesavename = Application.GetSaveAsFilename(InitialFileName:="Offert", filefilter:="PDF files (*.pdf), *.pdf")
    If filesavename = False Then Exit Sub
    
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=filesavename _
    , Quality:=xlQualityMedium, IncludeDocProperties:=False, _
    IgnorePrintAreas:=False, OpenAfterPublish:=True
    
    
    
    Exit Sub
    
    Errorhandler:
    MsgBox "Exit all other open pdf documents", vbOKOnly, "An error occured"
    
    End Sub
    Last edited by zyrr; 05-25-2012 at 11:21 AM. Reason: Better explanation of problem

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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