VBA Macro to Send Mutliple Emails to Multiple Contacts with Slightly Different Subject and Body

ak_254

New Member
Joined
Jan 9, 2018
Messages
10
Hi all,

This may be a bit of a long shot but I am trying to create or put together a VBA Macro for package distributions that will send out multiple email notification emails at once to the approriate point of contact each with slightly different subject header based on their location and the body of the email based on what the package contains.

Example:

Data Table:

[TABLE="width: 500"]
<tbody>[TR]
[TD]Content[/TD]
[TD]Customer[/TD]
[TD]Package Number[/TD]
[TD]Qty[/TD]
[/TR]
[TR]
[TD]Apples[/TD]
[TD]Tom[/TD]
[TD]11[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Oranges[/TD]
[TD]Bob[/TD]
[TD]22[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]Watermelon[/TD]
[TD]Jill[/TD]
[TD]33[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]Apples[/TD]
[TD]Tom[/TD]
[TD]44[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]Strawberry[/TD]
[TD]Tom[/TD]
[TD]55[/TD]
[TD]3[/TD]
[/TR]
</tbody>[/TABLE]


Ref Table:

[TABLE="width: 500"]
<tbody>[TR]
[TD]Customer[/TD]
[TD]Neighborhood[/TD]
[/TR]
[TR]
[TD]Tom[/TD]
[TD]Serra Mesa[/TD]
[/TR]
[TR]
[TD]Bob[/TD]
[TD]North Park[/TD]
[/TR]
[TR]
[TD]Jill[/TD]
[TD]Pacific Beach[/TD]
[/TR]
</tbody>[/TABLE]


In this case I want to be able to send out 1 unique email to each customer based on what the content of the package contains. In this case there will be a total of 4 emails being sent out at once.

Tom - Apples (Package 11/44) *Since Tom has 2 packages containing apples it will consolidate the info into 1 email*
Bob - Oranges (Package 22)
Jill - Watermelon (Package 33)
Tom - Strawberry (Package 55)


Example Email for Tom:

----------------------------------------------------------------------------------------------
To: Tom
Subject: Serra Mesa: Package Arrived containing Apples

Body:

Hi Tom,

Your package containing the following info has arrived

[TABLE="width: 500"]
<tbody>[TR]
[TD]Content[/TD]
[TD]Customer[/TD]
[TD]Package Number[/TD]
[TD]Qty[/TD]
[/TR]
[TR]
[TD]Apples[/TD]
[TD]Tom[/TD]
[TD]11[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Apples[/TD]
[TD]Tom[/TD]
[TD]44[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

----------------------------------------------------------------------------------------------

Example Email for Jill:

To: Jill
Subject: Pacific Beach: Package Arrived containing Watermelon

Body:

Hi Jill,

Your package containing the following info has arrived

[TABLE="width: 500"]
<tbody>[TR]
[TD]Content[/TD]
[TD]Customer[/TD]
[TD]Package Number[/TD]
[TD]Qty[/TD]
[/TR]
[TR]
[TD]Watermelon[/TD]
[TD]Jill[/TD]
[TD]33[/TD]
[TD]5[/TD]
[/TR]
</tbody>[/TABLE]

----------------------------------------------------------------------------------------------

Please let me know if you have any questions to better explain the issue.

Any help or point in the right direction is greatly appreciated!
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,223,895
Messages
6,175,257
Members
452,625
Latest member
saadat28

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