Outlook Does not recognize one or more names

Joined
Mar 3, 2021
Messages
15
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
 
Joined
Mar 3, 2021
Messages
15
Office Version
  1. 365
Platform
  1. Windows
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
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Joined
Mar 3, 2021
Messages
15
Office Version
  1. 365
Platform
  1. Windows
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.
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
37,806
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
Is it only one email address in each cell?
 

Forum statistics

Threads
1,148,022
Messages
5,744,368
Members
423,865
Latest member
SimSum

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
Top