+ Reply to Thread
Results 1 to 3 of 3

Force user to save as a different name

  1. #1
    Registered User
    Join Date
    11-29-2010
    Location
    Belgium
    MS-Off Ver
    2010
    Posts
    87

    Exclamation Force user to save as a different name

    Hi

    Whenever a users clicks "X" to close the workbook, a pop up needs to show asking if they want to quit without saving. If they click no, I want it to open the save as dialogue box. If the user then saves the file with the same name I need it to show a pop up stating they need to enter a different name (to prevent overwriting) and then go back to the save as dialogue box. If the user clicks cancel, a pop up should show up.
    Up until now I came up with following code. It does what I want except it doesn't prevent the user from overwriting the file.

    Can you pls help me out?

    Regards,
    Tino



    Sub Auto_Close()
    Dim Answer As String
    Dim bFileSaveAs As Boolean
    Answer = MsgBox("Are you done writing the orders for this supplier?" & vbCrLf & "Click no, if you want to save the file to continue later." & " (" & "Save under a different name!" & ")", vbQuestion + vbYesNo, "Finish?")
    If Answer = vbYes Then
    ThisWorkbook.Saved = True
    Else
    bFileSaveAs = Application.Dialogs(xlDialogSaveAs).Show
    If Not bFileSaveAs Then MsgBox "User cancelled!", vbCritical
    End If
    End Sub

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Force user to save as a different name

    As far as I can see you code what has been builtin in Excel ?



  3. #3
    Registered User
    Join Date
    11-29-2010
    Location
    Belgium
    MS-Off Ver
    2010
    Posts
    87

    Re: Force user to save as a different name

    Hi

    I don't quite understand what you mean.

    Pls specify.

    Regards,
    Tino XXL

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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