run-time error `-2147417851 (80010105)` RRS feed

  • Question

  • Hi All,

    I have a Macro to send from my outlook numerous report quickly by just pressing a button. I have been using the same code for 1 year (see below for code)

    Sub Send_Files()

    'Working in Excel 2000-2013

        Dim OutApp As Object
        Dim OutMail As Object
        Dim sh As Worksheet
        Dim cell As Range
        Dim FileCell As Range
        Dim rng As Range

        With Application
            .EnableEvents = False
            .ScreenUpdating = False
        End With

        Set sh = Sheets("Mail")

        Set OutApp = CreateObject("Outlook.Application")

        For Each cell In sh.Columns("B").Cells.SpecialCells(xlCellTypeConstants)

            'Enter the path/file names in the F:Z column in each row
            Set rng = sh.Cells(cell.Row, 1).Range("F1:Z1")

            If cell.Value Like "?*@?*.?*" And _
               Application.WorksheetFunction.CountA(rng) > 0 Then
                Set OutMail = OutApp.CreateItem(0)

                With OutMail
                    .to = cell.Value
                    .cc = sh.Cells(cell.Row, 3)
                    .Subject = sh.Cells(cell.Row, 4)
                    .Body = "Hi " & cell.Offset(0, -1) & cell(1, 4).Value
                    .SentOnBehalfOfName = """EUMEA FP&A Team""

                    For Each FileCell In rng.SpecialCells(xlCellTypeConstants)
                        If Trim(FileCell) <> "" Then
                            If Dir(FileCell.Value) <> "" Then
                                .Attachments.Add FileCell.Value
                            End If
                        End If
                    Next FileCell

                    .Send  'Or use .Display
                End With

                Set OutMail = Nothing
            End If
        Next cell

        Set OutApp = Nothing
        With Application
            .EnableEvents = True
            .ScreenUpdating = True
        End With
    'Completing macro
        Application.ScreenUpdating = True
        MsgBox ("Emails Sent! see under" & " " & "directory" & " " & Output_Dir)
        Exit Sub

    End Sub

    However, this month I am getting below error message. Any clue how to fix?

    run-time error `-2147417851 (80010105)`

    Method `CC` of object`_Mailitem` failed




    Thursday, December 6, 2018 5:23 PM

All replies

  • Shot in the dark.

    Is the default address book changed to offline and it can't see the list? or are you sending to a list in the spreadsheet?

    Just takes a click to give thanks for a helpful post or answer.
    Please vote “Helpful” or Mark as “Answer” as appropriate.
    Chris Ward
    Microsoft Community Contributor 2012

    • Marked as answer by Granis1 Thursday, December 6, 2018 5:46 PM
    • Unmarked as answer by Granis1 Thursday, December 6, 2018 5:46 PM
    Thursday, December 6, 2018 5:38 PM
  • Thanks for the shot:)

    The address book is the same as usual. But for the moment, I am testing it using myself as sender and receiver (did this before and no issue)

    Thursday, December 6, 2018 5:57 PM