amitcohen
Board Regular
- Joined
- Jan 14, 2010
- Messages
- 118
Hi
I'm trying to create code for the Email Body that will contain more the just one row.
I'm using the & vbNewLine & but when it come to the place where I need to refer to the cell in column A, VBA editor gives me error.
Can you spot the problem?
Thanks,
Amit
I'm trying to create code for the Email Body that will contain more the just one row.
I'm using the & vbNewLine & but when it come to the place where I need to refer to the cell in column A, VBA editor gives me error.
Can you spot the problem?
Code:
Sub Mail_With_Loop()
Dim olApp As Outlook.Application
Dim olMail As MailItem
For i = 2 To 50 Step 1
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = Range("H1").Value
.Body = "Hello" & vbNewLine & [COLOR=Red]Range(A" & i &").Value[/COLOR] & vbNewLine & "Text line" & vbNewLine & "Another text line" & vbNewLine & "And another one here"
.Display
End With
Next i
Set olMail = Nothing
Set olApp = Nothing
End Sub
Amit