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

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Is it only one email address in each cell?
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,636
Latest member
laura12345

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