Excel VBA: Outlook does not recognize one or more names

dougdrex

Board Regular
Joined
Sep 27, 2013
Messages
79
I'm using Excel 2010.

I have a string variable named strMaker that is assigned to another variable (to combine values with another variable) before being assigned to an outgoing email message using Outlook. The value contained in strMaker is an employee ID that gets assigned to the "Cc" field and sent via internal email.

The problem is that sometimes there is an employee ID of a person who is no longer with the company and the macro produces the "Outlook does not recognize one or more names" error. I would like to insert some code that would check to see if the employee ID (strMaker) is recognized by Outlook before assigning it to the "Cc" field of the email, and possibly even prompting the user to provide an alternative employee ID.

Below is the current code. Please let me know if you have any ideas.

Thanks!
Doug

Code:
Dim strMaker As String

strMaker = GetVisibleMaker(Range("H2", Cells(Rows.Count, "H").End(xlUp)))

strCC = strMaker & "; " & strDL

    With OlMailItem
        .CC = strCC
        .Send

Please let me know if more information is required.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,215,598
Messages
6,125,748
Members
449,258
Latest member
hdfarid

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