Canceling Document BeginSave Event

Discussion in 'AutoCAD' started by egcallis, Jan 28, 2005.

  1. egcallis

    egcallis Guest

    VBA AutoCAD 2004

    We want to cancel the save event if the user does not properly fill out a form. Here is the current code:

    Private Sub AcadDocument_BeginSave(ByVal FileName As String)
    If (FileName Like "Q:\CADD MASTERS\_Corporate*" And Right(FileName, 3) = "dwg" And Not ThisDrawing.Saved) Then
    MasteroMatic.UserForm1.show
    If (Not bOkay) Then
    'DO something to cancel the save operation
    End If
    End If
    End Sub
     
    egcallis, Jan 28, 2005
    #1
  2. You're trying to cancel the event you're handling. In such a situation,
    you need to check for a Cancel parameter as part of the event's
    signature. If you don't see one, you should not attempt to cancel the
    event in question from that event handler.

    Have you given any thought to redefining the SAVE and QSAVE commands?
    They could perform the necessary checks and call the internal version of
    those commands if everything checks out.
     
    Frank Oquendo, Jan 29, 2005
    #2
  3. Even if you redefine all the save commands you can't handle when AutoCAD prompts you to save.
    Regards - Nathan
     
    Nathan Taylor, Jan 30, 2005
    #3
  4. But it probably doesn't matter in this case.
     
    Nathan Taylor, Jan 30, 2005
    #4
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.