Hi,
Can someone tell me why this macro doesn't work in office 2016? There is a comment to say it works in 2000 - 2010?
Thanks All.
Can someone tell me why this macro doesn't work in office 2016? There is a comment to say it works in 2000 - 2010?
Thanks All.
VBA Code:
Option Explicit
Sub Mail_Small_Text_Outlook(ByVal aRow As Long)
'Working in Office 2000-2010
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim wsData As Worksheet
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
Set wsData = ThisWorkbook.Sheets("REQUESTS")
strbody = "<font face='Arial,Helvetica' color='Black'>Dear EU Team," & "<br><br>" & _
"A new request has been submitted by " & "<font color = 'Black'>" & Format(wsData.Range("B" & aRow).Value, "dd mmmm yyyy") & "<br><br>" & _
"The request is in relation to the above subject and the outline is as follows: " & "<br><br>" & _
"Requirement: " & "<br><br>" & wsData.Range("D" & aRow).Value & "</b></font>" & "<br><br>" & _
"An answer is required by " & "<font color = 'red'><b>" & Format(wsData.Range("f" & aRow).Value, "dd mmmm yyyy") & "<br><br>" & _
"<font face='Arial,Helvetica' color='Black'>The External Deadline is " & "<font color = 'red'><b>" & Format(wsData.Range("g" & aRow).Value, "dd mmmm yyyy")
On Error Resume Next
With OutMail
.To = "test@test.com"
.CC = ""
.BCC = ""
.Subject = wsData.Range("C" & aRow).Value & " " & wsData.Range("E" & aRow).Value
.HTMLBody = strbody
'You can add a file like this
'.Attachments.Add ("C:\test.txt")
.Display 'or use .Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub