Send Object cancel crash
-
- 3StarLounger
- Posts: 308
- Joined: 24 Dec 2015, 16:41
Send Object cancel crash
Greetings, invoking the Outlook client on the PC to open works fine - as does sending the email. But if one changes their mind and closes the outlook window without sending the email (using the X in the upper right) then Access has a spinning wheel and eventually gives up and closes.... Is there a way to avoid / manage this scenario?
-
- Administrator
- Posts: 78465
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Send Object cancel crash
In my experience, error 2501 occurs when the user cancels the email; an error handler can take care of that. Here is a very simple example:
Code: Select all
Sub Test()
On Error GoTo ErrHandler
DoCmd.SendObject ObjectType:=acSendNoObject, Subject:="Test", MessageText:="Hello World", EditMessage:=True
Exit Sub
ErrHandler:
If Err = 2501 Then
' Message canceled; ignore
Else
MsgBox Err.Description, vbExclamation
End If
End Sub
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 308
- Joined: 24 Dec 2015, 16:41
Re: Send Object cancel crash
hmmm so just trapping & ignoring will stop Access from the spin & crash.... interesting... thanks will give it a try.....