Cancel a Save??
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Cancel a Save??

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
Matt W
Guest





Posted: Sat Jan 08, 2005 12:12 am    Post subject: Cancel a Save?? Reply with quote

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??

--
I support two teams: The Red Sox and whoever beats the Yankees.

Back to top
Ed Jobe
Guest





Posted: Sat Jan 08, 2005 1:08 am    Post subject: Re: Cancel a Save?? Reply with quote

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
----
"Matt W" <nospam@address.withheld.com> wrote in message
news:41dedf06_3@newsprd01...
Quote:
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??

--
I support two teams: The Red Sox and whoever beats the Yankees.


Back to top
Matt W
Guest





Posted: Sat Jan 08, 2005 1:17 am    Post subject: Re: Cancel a Save?? Reply with quote

That's what I thought.
Thanks for the verification Ed.

--
I support two teams: The Red Sox and whoever beats the Yankees.

"Ed Jobe" <not.edljobe@hotmail.com> wrote in message
news:41deec50$1_3@newsprd01...
Quote:
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
----
"Matt W" <nospam@address.withheld.com> wrote in message
news:41dedf06_3@newsprd01...
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??

--
I support two teams: The Red Sox and whoever beats the Yankees.






Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB