Outlook Does not recognize one or more names

Joined
Mar 3, 2021
Messages
17
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have this macro to mail individual mail to my recipients with attachment. I have not altered this macro and it have worked up til now. I cannot find any error in my mail-addresses either. Any suggestions what to look for?


2021-06-28_10-42-18.png



VBA Code:
Sub Email_From_Excel_Attachments()

    Dim emailApplication    As Object, emailItem As Object
    Dim cell                As Range, rng        As Range
    
    On Error GoTo myerror
    Set emailApplication = CreateObject("Outlook.Application")
    
    With Sheets("Adresses")
        lastrow = .Cells(.Rows.Count, "B").End(xlUp).Row - 1
        Set rng = .Cells(2, 2).Resize(lastrow, 1)
    End With
    
    For Each cell In rng.Cells
        Set emailItem = emailApplication.CreateItem(0)
    
        With emailItem
            .To = cell.Value
            .cc = cell.Offset(, 1).Value
            .Subject = cell.Offset(, 2).Value & Date
            .Body = cell.Offset(, 3).Value
            .Attachments.Add cell.Offset(, 4).Value
            .Send
        End With
        Set emailItem = Nothing
    Next cell
myerror:
    If Err <> 0 Then MsgBox (Error(Err)), 48, "Error"
End Sub
 
A literal email address should work regardless of whether it exists in your contacts. Can you actually send the email immediately after it displays?
I can send it directly in outlook without hitting "enter" so it doesn't convert to name.

But I guess this turned out to be an outlook problem rather than an excel problem.

Many thanks for your help
 
Upvote 0

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I can send it directly in outlook without hitting "enter" so it doesn't convert to name.

But I guess this turned out to be an outlook problem rather than an excel problem.

Many thanks for your help
I can also send it before it changes to name from the display step you advised me to add for the trouble shooting.
 
Upvote 0
Is it only one email address in each cell?
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,392
Members
449,081
Latest member
JAMES KECULAH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top