CheekyDevil
New Member
- Joined
- Apr 15, 2018
- Messages
- 20
Hi Excel genius'!
I need a variation of the following code to use a range of cells as the email body.
I have the following that adds the signature, but does not add the range of cells. Is this able to be modified to add the cell range?
Thank you to all who can assist with this
I need a variation of the following code to use a range of cells as the email body.
I have the following that adds the signature, but does not add the range of cells. Is this able to be modified to add the cell range?
Thank you to all who can assist with this
Code:
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
On Error Resume Next
Set rng = Sheet1.Range("A1:B5").SpecialCells(xlCellTypeVisible) 'This piece of code is not working
On Error GoTo 0
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.HTMLBody = rng & "
" & .HTMLBody
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub