I have multiple products from different suppliers. I need to email each supplier a table with only their products. I have more than 2000 suppliers with each about 10 to 100 products. I need the supplier to complete the data required for each product.
a code from @DanteAmor works to filter and place the email address into the "to" section, but I don't know how to get the table either attached or part as the body in the email
Vendor Name is in E, email address is in F, A:H is the whole table or Table8.
Sub create_multiple_emails()
Dim c As Range, sh As Worksheet, ky As Variant, m As Range, sBody As String
Dim dam As Object, dict As Object
Set sh = Sheets("MASTER")
Set dict = CreateObject("scripting.dictionary")
For Each c In sh.Range("F2", sh.Range("F" & Rows.Count).End(xlUp))
If Not dict.exists(c.Value) Then
dict(c.Value) = dict(c.Value)
sh.Range("A1").AutoFilter 1, C
Set dam = CreateObject("Outlook.Application").CreateItem(0)
dam.To = c
dam.Subject = "Subject"
dam.body = sBody
'dam.Send 'to send
dam.display 'to show
End If
Next
sh.ShowAllData
End Sub
a code from @DanteAmor works to filter and place the email address into the "to" section, but I don't know how to get the table either attached or part as the body in the email
Vendor Name is in E, email address is in F, A:H is the whole table or Table8.
Sub create_multiple_emails()
Dim c As Range, sh As Worksheet, ky As Variant, m As Range, sBody As String
Dim dam As Object, dict As Object
Set sh = Sheets("MASTER")
Set dict = CreateObject("scripting.dictionary")
For Each c In sh.Range("F2", sh.Range("F" & Rows.Count).End(xlUp))
If Not dict.exists(c.Value) Then
dict(c.Value) = dict(c.Value)
sh.Range("A1").AutoFilter 1, C
Set dam = CreateObject("Outlook.Application").CreateItem(0)
dam.To = c
dam.Subject = "Subject"
dam.body = sBody
'dam.Send 'to send
dam.display 'to show
End If
Next
sh.ShowAllData
End Sub