Hi
Would someone be able to help with the VBA code to get VBA to send a table of data from excel using Outlook?
Eg: how do you get the below table of data (spread across 4 rows and 4 colulmns) into an Outlook email body?
Account Water Earth Fire
123 48 7 6
1234 4 65 0
12345 54 74 4
I have the below code which I use to generate emails but the body field of the email only picks up data from one column, I am trying to include the above table into the email body.
Thank you so much
Sub Email12()
EmailNo = 0
Range("B2").Select
Do Until ActiveCell.Offset(0, -1) = Range("C2").Value
ActiveCell.Offset(1, 0).Select
Loop
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = ActiveCell.Offset(0, 1).Value
.CC = ActiveCell.Offset(1, 1).Value
.Subject = ActiveCell.Offset(2, 1).Value
Do Until ActiveCell.Value = "Subject:"
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(1, 0).Select
Do Until ActiveCell.Value = Range("C3")
ActiveCell.Offset(1, 0).Select
.body = .body + ActiveCell.Value + vbCrLf
Loop
.Display
End With
Range("A1").Select
End Sub
Would someone be able to help with the VBA code to get VBA to send a table of data from excel using Outlook?
Eg: how do you get the below table of data (spread across 4 rows and 4 colulmns) into an Outlook email body?
Account Water Earth Fire
123 48 7 6
1234 4 65 0
12345 54 74 4
I have the below code which I use to generate emails but the body field of the email only picks up data from one column, I am trying to include the above table into the email body.
Thank you so much
Sub Email12()
EmailNo = 0
Range("B2").Select
Do Until ActiveCell.Offset(0, -1) = Range("C2").Value
ActiveCell.Offset(1, 0).Select
Loop
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = ActiveCell.Offset(0, 1).Value
.CC = ActiveCell.Offset(1, 1).Value
.Subject = ActiveCell.Offset(2, 1).Value
Do Until ActiveCell.Value = "Subject:"
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(1, 0).Select
Do Until ActiveCell.Value = Range("C3")
ActiveCell.Offset(1, 0).Select
.body = .body + ActiveCell.Value + vbCrLf
Loop
.Display
End With
Range("A1").Select
End Sub