Hello-
I have this code that I was able to string together that would email from Excel using Outlook. Honestly, it is barely doing what I would like it to do. What i'm trying to do, I'm sure is very simple for you guys. I have a distribution list with many rows. Basic name with email address. I want to have a VBA code that will email each row the same text in an email. I want it to attach the same PDF to every email. I would also like to be able to enter a signature card in that email, but I don't know how to do that. Here is what I have so far. Can someone please tell me what I should enter in VBA to accomplish this? I'm super pressed for time because my manager is wanting this ASAP and I have already spend about 2 days trying to pull this together. Any help I can get I would appreciate greatly. Thank you!
Sub SendEmail(what_address As String, subject_line As String, mail_body As String)
Dim olApp As Outlook.Application
Set olApp = CreateObject("Outlook.Application")
Dim olMail As Outlook.MailItem
Set olMail = olApp.CreateItem(olMailItem)
olMail.To = what_address
olMail.Subject = subject_line
olMail.Body = mail_body
olMail.Send
End Sub
Sub SendMassEmail()
row_number = 1
Do
DoEvents
row_number = row_number + 1
Dim mail_body_message As String
Dim full_name As String
mail_body_message = Sheet2.Range("J2")
full_name = Sheet2.Range("c" & row_number)
mail_body_message = Replace(mail_body_message, "replace_name_here", full_name)
Call SendEmail(Sheet2.Range("A" & row_number), "Request for Tax Exemption Certificate", mail_body_message)
Loop Until row_number = 4
End Sub
I have this code that I was able to string together that would email from Excel using Outlook. Honestly, it is barely doing what I would like it to do. What i'm trying to do, I'm sure is very simple for you guys. I have a distribution list with many rows. Basic name with email address. I want to have a VBA code that will email each row the same text in an email. I want it to attach the same PDF to every email. I would also like to be able to enter a signature card in that email, but I don't know how to do that. Here is what I have so far. Can someone please tell me what I should enter in VBA to accomplish this? I'm super pressed for time because my manager is wanting this ASAP and I have already spend about 2 days trying to pull this together. Any help I can get I would appreciate greatly. Thank you!
Sub SendEmail(what_address As String, subject_line As String, mail_body As String)
Dim olApp As Outlook.Application
Set olApp = CreateObject("Outlook.Application")
Dim olMail As Outlook.MailItem
Set olMail = olApp.CreateItem(olMailItem)
olMail.To = what_address
olMail.Subject = subject_line
olMail.Body = mail_body
olMail.Send
End Sub
Sub SendMassEmail()
row_number = 1
Do
DoEvents
row_number = row_number + 1
Dim mail_body_message As String
Dim full_name As String
mail_body_message = Sheet2.Range("J2")
full_name = Sheet2.Range("c" & row_number)
mail_body_message = Replace(mail_body_message, "replace_name_here", full_name)
Call SendEmail(Sheet2.Range("A" & row_number), "Request for Tax Exemption Certificate", mail_body_message)
Loop Until row_number = 4
End Sub