Excel VBA: Pass value of string variable to variable of another type

dougdrex

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

Maybe this is something that cannot be done because I have searched the internet for instructions, but to no avail.

I have a string variable that gets entered into the "Cc" field of an email. However, before I send out the email message (through Outlook), I need to check it in our internal global address book to make sure it is a valid ID (sometimes employees leave the company) so it won't cause an error message.

In order to use the .ResolveAll command, the value needs to be in a variable defined as an Outlook.Recipient (at least that is my understanding). How can I pass the value of the string variable to the other variable without it generating an error (I've tried several methods).

If posting the significant portions of my code would help, please let me know.


Thanks!
Doug
 
Well to be honest I'm not 100% clear what values you would want in the 'To' and 'Cc' fields.

Does the 'To' column contain a single ID for the principal recipient of the email and the 'Cc' column a string which includes the IDs for all the people being copied in?
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Yes, the "To" column will generally have a single ID (sometimes it will have a distribution list, but those don't need to be checked). The "Cc" field will normally have multiple IDs, along with a distribution list.

If there is a way to check them before they are assigned to the "To" or "Cc" fields, that would be great. If not, I'll do whatever is possible to check them and, if required, remove them instead of getting an error message.
 
Upvote 0
Sorry, I'm not following.

The only way to check the 'To' and 'Cc' fields, as far as I know anyway, is to set up the recipients of the email and then use ResolveAll.

If ResolveAll fails you can then go through the recipients to check which ones were unresolved.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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