Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel: Unable to trap 287 error with Outlook Security Dialog
Hi,
I would very much appreciate it if someone can save my sanity and help me with the following problem. I am sending automated e-mails using the Outlook object model from Excel. The problem being when 'No' is clicked on the Outlook Security Dialog Box I am unable to trap the error in Excel and my application falls over with Error: '287' . Here is my code... Public Function SendEmailToGroup(strAttachPathFilename As String, strGroupName As String) As Boolean On Error GoTo ErrorMsgs Dim OL As Object ' Outlook instantiation Dim EmailItem As Object ' A new mail item (e-mail) Dim oEmailGroup As EmailGroup Dim strRecipientList As String Set OL = CreateObject("Outlook.Application") ' New Outlook application Set EmailItem = OL.CreateItem(olMailItem) ' new MailItem Set oEmailGroup = New EmailGroup If Not oEmailGroup.LoadByName(strGroupName) Then Err.Raise ERR_BAD_EMAIL_GROUPNAME, , "Email group " & strGroupName & " was not found" End If strRecipientList = "" & oEmailGroup.GetRecipientList With EmailItem .Subject = "Five Overnights" .Body = strEmailContent .To = "" & strRecipientList .Importance = olImportanceNormal .Attachments.Add "" & strAttachPathFilename If EmailItem.Send Then End With SendEmailToGroup = True strRecipientList = "" Set EmailItem = Nothing Set OL = Nothing Set oEmailGroup = Nothing Exit Function ErrorMsgs: Err.Clear MsgBox "E-mail Configuration incorrect. Workbook not sent." _ & vbCrLf & vbCrLf & " Workbook saved in default save directory.", vbExclamation, "" & strGroupName & ": Error Sending Report" SendEmailToGroup = False strRecipientList = "" Set EmailItem = Nothing Set OL = Nothing Set oEmailGroup = Nothing Exit Function End Function Thanks, Lex |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Unable to change security in Excel 2007 | New Users to Excel | |||
Error Handling - On Error GoTo doesn't trap error successfully | Excel Programming | |||
Excel Spreadsheet email attachment unable to open in Outlook Expr. | Excel Discussion (Misc queries) | |||
disregard the Outlook dialog box sending task/eMail from Excel 2003 | Excel Programming | |||
Prevent dialog - Prevents Sending Excel File From Outlook | Excel Programming |