Pheonix2332
New Member
- Joined
- Feb 3, 2021
- Messages
- 20
- Office Version
- 2013
- Platform
- Windows
good afternoon all,
I've been tasked to contact over 500 companies my work deals with on a regular basis and need updated details from, I have collated an email sheet and have used the following code to produce the emails to each company, as I didn't want to fill out an additional column on every row I have used a text box with the pre filled in email with the greeting changing based on when the time of day changes i.e. morning/ afternoon, and within the email I'm using the web address we have for the company on record and their name. however I'm having difficulties getting my signature to remain on each email and having to manually add it back in every time this is the code am using -
if anybody can identify what can be changed or what I have missed will be greatly appreciated the textbox field is also below -
B2,
I am contacting you from Transit communications and have obtained your email address directly from your website E2
Could you please advise me of an email address for our client relations to contact A2 for any future enquiries relating to Transit Movements entering or leaving the UK.
This will enable your company to receive correspondence directly via email
Alternatively if you do not wish to be contacted via email let me know.
Kindly reply to this email at your earliest convenience.
I've been tasked to contact over 500 companies my work deals with on a regular basis and need updated details from, I have collated an email sheet and have used the following code to produce the emails to each company, as I didn't want to fill out an additional column on every row I have used a text box with the pre filled in email with the greeting changing based on when the time of day changes i.e. morning/ afternoon, and within the email I'm using the web address we have for the company on record and their name. however I'm having difficulties getting my signature to remain on each email and having to manually add it back in every time this is the code am using -
VBA Code:
Sub send_mass_email()
Dim i As Integer
Dim Greeting, email, body, subject, business, Website As String
Dim OutApp As Object
Dim OutMail As Object
body = ActiveSheet.TextBoxes("TextBox 1").Text
i = 2
'Loop down name column starting at row 2 column 1
Do While Cells(i, 1).Value <> ""
Greeting = Cells(i, 2).Value
email = Cells(i, 3).Value
body = ActiveSheet.TextBoxes("TextBox 1").Text
subject = Cells(i, 4).Value
business = Cells(i, 1).Value
Website = Cells(i, 5).Value
' replace place holders
body = Replace(body, "B2", Greeting)
body = Replace(body, "A2", business)
body = Replace(body, "E2", Website)
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.to = email
.subject = subject
.body = body
.Display ' will be changed to send with works
End With
'reset body text
body = ActiveSheet.TextBoxes("TextBox 1").Text
i = i + 1
Loop
Set OutMail = Nothing
Set OutApp = Nothing
MsgBox "Email(s) Sent!"
End Sub
if anybody can identify what can be changed or what I have missed will be greatly appreciated the textbox field is also below -
B2,
I am contacting you from Transit communications and have obtained your email address directly from your website E2
Could you please advise me of an email address for our client relations to contact A2 for any future enquiries relating to Transit Movements entering or leaving the UK.
This will enable your company to receive correspondence directly via email
Alternatively if you do not wish to be contacted via email let me know.
Kindly reply to this email at your earliest convenience.