unanswered How to use the = Range ("") function to insert several defined cells

6 months 1 week ago #2044 by Mcpointon
Hello,  Using the VBA below, how do I insert several cell values into the .Subject =Range("G17") ?  I want to add B7, B9, F9, I9 and G13 aswell into the strings in the Subject.
 'Updated by Extendoffice 2017/9/14
Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
On Error Resume Next
Set xOutApp = CreateObject("Outlook.Application")
Set xOutMail = xOutApp.CreateItem(0)
xMailBody = "Body content" & vbNewLine & vbNewLine & _
"This is line 1" & vbNewLine & _
"This is line 2"
On Error Resume Next
With xOutMail
.To = Range("G17")
.CC = "SUGB-QEHS@wartsila.com"
.BCC = ""
.Subject = Range("B7")
.Body = xMailBody
.Display 'or use .Send
End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub

Please Log in or Create an account to join the conversation.

Moderators: jaychivoExcelfansqiuhongkun