send multiple emails to suppliers containing their information

atditiljazi

New Member
Joined
Nov 22, 2022
Messages
41
Office Version
  1. 365
Platform
  1. Windows
hi, i set up up a macro that will send a spreadsheet (sheet1) as an attachment in an email, but i now want it to do more than that.

i would like the macro to pick out the suppliers by the supplier codes (for example Column F) and send them all the delivery details. the macro will have to pick out all the rows that relates to unique supplier code and also A1 row (header) and put it into the email as an attachment. i would also like to link the supplier code with the email address it relates to on sheet 2.

here is my current macro,

Sub email_from_excel_basic()



Dim emailapplication As Object

Dim emailitem As Object



Set emailapplication = CreateObject("outlook.application")

Set emailitem = emailapplication.createitem(0)



'Now we build the email.

emailitem.to = ""



emailitem.CC = ""



emailitem.Subject = ""



emailitem.body = ""



' Attach current workbook

emailitem.attachments.Add ActiveWorkbook.FullName



' send the email

emailitem.send



' display the email so the user can change it as desired before sending it.

'emailitem.display



End Sub



emailitem.body = ""



' Attach current workbook

emailitem.attachments.Add ActiveWorkbook.FullName



' send the email

emailitem.send



' display the email so the user can change it as desired before sending it.

'emailitem.display



End Sub


Book1
E
21
Sheet1
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

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