atditiljazi
New Member
- Joined
- Nov 22, 2022
- Messages
- 41
- Office Version
- 365
- Platform
- 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
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 |