Dear mr/mrs,
Below VBA is working on outlook 2016,
can somebody help me why the body is blank?
I don't understand this problem, so I am looking for some help.
Thank you in advance for your support
Dim strbody As String
Dim oApp As Object
Dim oMail As Object
Dim WB As Workbook
Dim FileName As String
Dim wSht As Worksheet
Dim shtName As String
Dim ThisFile As String
Dim oByValue
ThisFile = "C:\test\Test1.xlsx"
Application.ScreenUpdating = False
'Create and show the Outlook mail item
Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItem(0)
With oMail
.To = Sheets("Sheet1").Range("B1").Value
.Subject = Sheets("Sheet1").Range("B2").Value
With ThisWorkbook.Sheets("Sheet1")
strbody = "Dear mrs Rania," & vbNewLine & vbNewLine & _
.Range("B3") & vbNewLine & _
.Range("B4") & vbNewLine & _
.Range("B5") & vbNewLine & _
.Range("B6") & vbNewLine & _
.Range("B7") & vbNewLine & _
.Range("B8") & vbNewLine & _
.Range("B9")
End With
.Attachments.Add ThisFile
.Attachments.Add "C:\test\Test1.xlsx", oByValue, 0
.Display
End With
'Restore screen updating and release Outlook
Application.ScreenUpdating = True
Set oMail = Nothing
Set oApp = Nothing
End Sub[/CODE]
Bookmarks