Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Error Trapping

the below program automatically detects the default mailsystem
( outlook or lotus notes) and emails the worksheet. I want to include
error trapping in this incase the workbook is not emailed. May i
request your help.

Thanks 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 "
Else
If SendWithLotusNotes(voefilename, filename,
strRecipients) = False Then
'alert the user if the SendWithLotusNotes code
doesn't run successfully
MsgBox "The suggestion has NOT been successfully
sent but, it has been Saved in " , vbExclamation + vbOKOnly, "File
was NOT emailed"
GoTo exSub
End If
End If
Case Else
MsgBox "Outlook/Lotus Notes is not configured."
End Select

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Error Trapping

jerry, I do not understand. Your code is so complex it shows deep knowledge
of VBA programming, and for someone as knowledgeable, it should be clear that
all you have to do is add:

OnError goto myErrorTrap

MyErrorTrap:

' Put your error code here


"jerry" wrote:

the below program automatically detects the default mailsystem
( outlook or lotus notes) and emails the worksheet. I want to include
error trapping in this incase the workbook is not emailed. May i
request your help.

Thanks 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 "
Else
If SendWithLotusNotes(voefilename, filename,
strRecipients) = False Then
'alert the user if the SendWithLotusNotes code
doesn't run successfully
MsgBox "The suggestion has NOT been successfully
sent but, it has been Saved in " , vbExclamation + vbOKOnly, "File
was NOT emailed"
GoTo exSub
End If
End If
Case Else
MsgBox "Outlook/Lotus Notes is not configured."
End Select


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 82
Default Error Trapping

jerry

I don't think is possible in Excel VBA.

For a start an emailing not being sent probably wouldn't be regarded
as an error, sp hpw could you trap it.

I would think it's more likely you'd have to work with the email
clients to see if the email has been sent.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Error Trapping

On Sep 1, 7:11*pm, norie wrote:
jerry

I don't think is possible in Excel VBA.

For a start an emailing not being sent probably wouldn't be regarded
as anerror, sp hpw could you trap it.

I would think it's more likely you'd have to work with the email
clients to see if the email has been sent.


Thanks Jerry and Norie. I did try including the error trapping but it
didnt work.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
while deleting rows it finds an error - error trapping Janis Excel Programming 2 July 19th 07 12:12 AM
Error trapping [email protected] Excel Programming 2 July 2nd 06 01:23 PM
Error Trapping Andrew Excel Programming 1 April 5th 05 07:23 AM
error trapping [email protected] Excel Programming 2 April 5th 05 12:52 AM
Error trapping Luis Excel Programming 1 November 11th 04 03:25 AM


All times are GMT +1. The time now is 10:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"