I currently have a spreadsheet that pulls information out from another sheet. It uses a series of Vlookup formulas to generate a message using the client's details in Sheet1. To send these emails I have been using two macro commands. One simply copies the range (B4:L36):
Sub Copy()
Copy Macro
Range("B4:L36").Select
Selection.Copy
End Sub
The other command opens a blank email:
Sub MailIt()
Dim oMailItem As Object
Dim oOLapp As Object
Set oOLapp = CreateObject("Outlook.application")
Set oMailItem = oOLapp.CreateItem(0)
With oMailItem
.To = ""
.CC = ""
.Subject = ""
.Body = ""
.Display
End With
Set oOLapp = Nothing
Set oMailItem = Nothing
End Sub
I then paste the message as a picture in the email body. I go back to my spreadsheet and copy the generated title from the range E1:J1 and paste this as my email subject. Lastly, I copy the recipient address from L2 and paste it into my email and send.
Is there a way to have a VBA command that:
- looks at the address in L2 and pastes it as the recipient address in the email (assuming that the VLookup formula would not interfere with this).
- copies the title range from E1:J1 and pastes it as the email subject.
- copies the message range (B4:L36) and pastes it as the email body (as a picture).
As a visual example of what the spreadsheet is doing please see the hyperlink. The basic idea is that it is taking the details from the INFO tab and using the VLookup formulas to generate the message in the Proforma tab (for data protective reasons, I've blacked out the message). If there are better methods of doing this, please let me know - I'm always happy to learn more!
I have done a lot of research into this and have found that it is possible to create emails that do this, however, I am struggling to get it to work and would appreciate some help!
Thank you.