I was wondering if this is even possible to be done with VBA.
I have to send roughly 1000 emails per month. They give me an excel with 2 collums: the first one is the full name which is the subject of the email and I search the .pdf that I need to attach. The second collum is the email of the receiver which I insert in the "To".
I've search in this forum and found this send multiple emails with spreadsheet attachments with a macro which is very close to the thing I need but I can't figure out how to change the code to accomodate my needs. ( i've tried adding additional variable and another loop, but I've been stuck even before that "Dim rng As Range, c As Range, i As Long, v As Variant, lastRow As Long", VBA says I didn't declare it and I can't figure what it wants.
Also there is a bit tricky part that I don't think is possible to be coded. There is 8 digits part of the name of the .pdf which is GDPR sensitive and I manually edit every .pdf before attaching it to the email, is it possible to edit the name of the .pdf and delete the first 8 digits.
Additionally I've already found a code to insert specify "From" ( team e-mail) and specific template of the body of the email. - credits :
I have to send roughly 1000 emails per month. They give me an excel with 2 collums: the first one is the full name which is the subject of the email and I search the .pdf that I need to attach. The second collum is the email of the receiver which I insert in the "To".
I've search in this forum and found this send multiple emails with spreadsheet attachments with a macro which is very close to the thing I need but I can't figure out how to change the code to accomodate my needs. ( i've tried adding additional variable and another loop, but I've been stuck even before that "Dim rng As Range, c As Range, i As Long, v As Variant, lastRow As Long", VBA says I didn't declare it and I can't figure what it wants.
Also there is a bit tricky part that I don't think is possible to be coded. There is 8 digits part of the name of the .pdf which is GDPR sensitive and I manually edit every .pdf before attaching it to the email, is it possible to edit the name of the .pdf and delete the first 8 digits.
Additionally I've already found a code to insert specify "From" ( team e-mail) and specific template of the body of the email. - credits :
VBA Code:
Sub Send_from_another()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "<p>template here</p>" & _
On Error Resume Next
With OutMail
.SentOnBehalfOfName = ("team email")
.To = ""
.CC = ""
.BCC = ""
.Subject = ""
.Display
.HTMLBody = strbody & .HTMLBody
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub