Cancel a Save??

Discussion in 'AutoCAD' started by Matt W, Jan 7, 2005.

  1. Matt W

    Matt W Guest

    It doesn't look like this can be done but I just wanted to verify.

    I've got this snippet of code in my BeginCommand event not the BeginSave
    event...

    Case "QSAVE"
    retVal = MsgBox("Would you like to save?", vbYesNo, "Save Test")
    If retVal = vbYes Then
    MsgBox "Save"
    Else
    MsgBox "Don't Save"
    End If

    If I select No, it still saves. Is there any way around this??
     
    Matt W, Jan 7, 2005
    #1
  2. Matt W

    Ed Jobe Guest

    Unfortunately, once a command has started, you can't cancel it. This has
    been a api wishlist item for years. The events signature should look like:
    Private Sub Doc_BeginCommand(ByVal CommandName As String, Cancel As Boolean)

    End Sub

    That way, in your If logic, instead of just MsgBox "Don't save.", you would:
    Cancel = vbTrue. Your only option is to redefine the QSAVE command.
     
    Ed Jobe, Jan 7, 2005
    #2
  3. Matt W

    Matt W Guest

    That's what I thought.
    Thanks for the verification Ed.
     
    Matt W, Jan 7, 2005
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.