Error Trapping with Select statement

J

jerry

Below is my code for sending a worksheet automatically using the
default mailsystem . I want to include error trapping within this
select case. currently even after detecting the default mailsystem,
the email cannt be sent due to way the mailsystem has been installed.

Thanks in advance for your help.

Select Case Application.MailSystem
'If outlook send the email
Case xlMAPI
ActiveWorkbook.SendMail Recipients:=strRecipients
MsgBox "Thank You."
Case xlNoMailSystem
If LotusNotesInstalled = False Then 'check if Lotus
Notes is installed
MsgBox "No mail system installed! Please send the
email by attaching the file directly from " & workrequestfilename
Else
If SendWithLotusNotes(workrequestfilename, filename,
strRecipients) = False Then
'alert the user if the SendWithLotusNotes code
doesn't run successfully
MsgBox "The Work Request has NOT been successfully
sent but, it has been Saved " , vbExclamation + vbOKOnly, "File was
NOT emailed"
GoTo exSub
End If
End If
Case Else
MsgBox "Mailsystem(Outlook/Lotus Notes) is not
configured. " & workrequestfilename
End Select
 
T

That Guy

It would appear that you have trapped most of the errors here. What is
it you are looking to trap?

please clarify.
 
J

Jerry

when it enters the case xlmapi, the program looks for outlook mailsystem. If
its not outlook it throws 1004 error. I need to either capture the error or
check its outlook mailsytem/lotus notes.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Top