Outlook Error 'The operation cannot be performed because the object has been deleted.'

Discussion in 'Microsoft Outlook Discussion' started by Rolf, Feb 27, 2006.

  1. Rolf

    Rolf Guest

    Hi all,

    I am sending a mail through Excel, we now have Office 2003. On Office
    2k it was still working for ages. I am having the mail in a VBA class.
    The part below throws the error 'The operation cannot be performed
    because the object has been deleted.' when i show the MailItem before
    sending AND having an file attached. If i am sending the mail with or
    without attachment straight without displaying first, it works perfekt.
    Has anybody an idea?

    Intersting, if i remove and add the attachment again when displaying
    the mail, it works. The problem causes the attachment. (The file
    attached file is small, just a single s/s with one page and a few
    lines.) Ihave no clue how i can make it run again with displaying the
    msg first.

    Thx and Cheers
    Rolf

    'Simpyfied sending procedure in clsMail
    Public Sub SendMail()

    Dim objOutlook As Outlook.Application
    Dim objMailItem As Outlook.MailItem
    Dim objRecipient As Object

    Dim i As Integer
    Dim iCountWrongRecipients As Integer

    On Error GoTo Err_MailTo_Immediat

    Set objOutlook = Outlook.Application
    Set objMailItem = objOutlook.CreateItem(olMailItem)
    With objMailItem
    'Check if they exist, if not, underline them red
    If IsArray(MailTo) Then
    For i = LBound(vaMailTo) To UBound(MailTo)
    Set objRecipient =
    objMailItem.Recipients.Add(MailTo(i))
    objRecipient.Type = 1 'olTo
    If Not objRecipient.Resolve Then
    iCountWrongRecipients = iCountWrongRecipients + 1
    End If
    Next
    End If

    'THE PART WITH THE ATTACHMENT RESULTS THE ERROR!
    'If optional variable has a attachement
    If Not IsEmpty(Attachements) And IsArray(Attachements) Then
    For i = LBound(Attachements) To UBound(Attachements)
    .Attachments.Add Attachements(i)
    Next
    End If

    .Subject = Header
    .BodyFormat = 1 'olFormatPlain
    .Body = Message

    '.Display
    .Importance = Importance 'bytImportance 'olImportanceHigh = 2
    'show message on screen for checking/adding/correcting
    If iCountWrongRecipients > 0 Then
    MsgBox iCountWrongRecipients & " recipeints could not be
    resolved!", vbExclamation
    bDisplay = True 'Errors, so display anyway
    End If
    'Display msg b4 send
    If bDisplay And iCountWrongRecipients > 0 Then
    Call LogData(iCountWrongRecipients & " recipeints could not
    be resolved!")
    .Display
    ElseIf bDisplay Then
    .Display
    Else
    .Send
    End If
    End With
    Set objOutlook = Nothing
    Set objMailItem = Nothing
    ReturnID = 0
    Exit Sub

    Err_MailTo_Immediat:
    lReturnID = Err.Number
    sReturnMsg = Err.Description
    End Sub
     
    Rolf, Feb 27, 2006
    #1
    1. Advertisements

  2. Rolf

    Rolf Guest

    Re: Outlook Error 'The operation cannot be performed because the object has been deleted.'

    The problem is solved. The causing comonent was an Add-In in Outlook.
    Tools-Options...-Other-Advanced Options...-Add-In Manager... Removing
    it and everything worked fine. ...or fix the add-in ;-)
     
    Rolf, Mar 2, 2006
    #2
    1. Advertisements

  3. Rolf

    sarabjeetsidhu

    Joined:
    Jun 8, 2006
    Messages:
    1
    Likes Received:
    0
    OUTLOOK ERROR - Object deleted

    Hi,

    I am getting the error while trying to send outlook mail using microsoft excel.
    The error is that "The operation cannot be performed because the object has been deleted."

    Do somebody have resolution to this problem.

    Thanx,

    SIDHU
     
    sarabjeetsidhu, Jun 8, 2006
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    2
    Views:
    1,204
    Guest
    Sep 6, 2006
  2. Guest

    operation cannot be performed because object has been deleted

    Guest, Oct 4, 2006, in forum: Microsoft Outlook Discussion
    Replies:
    0
    Views:
    512
    Guest
    Oct 4, 2006
  3. Guest
    Replies:
    0
    Views:
    158
    Guest
    Jul 26, 2007
  4. LW
    Replies:
    1
    Views:
    475
    Brian Tillman
    Mar 7, 2008
  5. doug
    Replies:
    1
    Views:
    143
    Roady [MVP]
    Sep 23, 2009
Loading...

Share This Page