With the help of a function from Ron de Bruin:
Sub SEND_TO_OUTLOOK()
Dim OLApp As Outlook.Application, OLMail As Object
Dim fName As String, wbVar() As String
Dim wsVar As Variant, x As Integer
wsVar = Array("1", "2", "3", "4", "5", "6", "7", "8")
ReDim wbVar(UBound(wsVar))
For x = 0 To UBound(wsVar)
fName = Sheets(wsVar(x)).Range("S33").Value
Sheets(wsVar(x)).Copy
With ActiveWorkbook
.SaveAs ThisWorkbook.Path & "\" & fName & ".xlsx"
.Close False
wbVar(x) = ThisWorkbook.Path & "\" & fName & ".xlsx"
End With
Next x
Set OLApp = New Outlook.Application
Set OLMail = OLApp.CreateItem(0)
OLApp.Session.Logon
With OLMail
.Display
.To = "WHOEVER.com"
.CC = ""
.BCC = ""
.Subject = "LOADS INTO SUBJECT LINE CORRECTLY"
.HTMLBody = RangetoHTML(Sheets("DATA").Range("C8:AN42"))
For x = 0 To UBound(wbVar)
.Attachments.Add wbVar(x)
Kill wbVar(x)
Next x
End With
Set OLMail = Nothing
Set OLApp = Nothing
End Sub
Function RangetoHTML(rng As Range)
' Changed by Ron de Bruin 28-Oct-2006
' Working in Office 2000-2016
Dim fso As Object
Dim ts As Object
Dim TempFile As String
Dim TempWB As Workbook
TempFile = Environ$("temp") & "\" & Format(Now, "dd-mm-yy h-mm-ss") & ".htm"
'Copy the range and create a new workbook to past the data in
rng.Copy
Set TempWB = Workbooks.Add(1)
With TempWB.Sheets(1)
.Cells(1).PasteSpecial Paste:=8
.Cells(1).PasteSpecial xlPasteValues, , False, False
.Cells(1).PasteSpecial xlPasteFormats, , False, False
.Cells(1).Select
Application.CutCopyMode = False
On Error Resume Next
.DrawingObjects.Visible = True
.DrawingObjects.Delete
On Error GoTo 0
End With
'Publish the sheet to a htm file
With TempWB.PublishObjects.Add( _
SourceType:=xlSourceRange, _
Filename:=TempFile, _
Sheet:=TempWB.Sheets(1).Name, _
Source:=TempWB.Sheets(1).UsedRange.Address, _
HtmlType:=xlHtmlStatic)
.Publish (True)
End With
'Read all data from the htm file into RangetoHTML
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, -2)
RangetoHTML = ts.readall
ts.Close
RangetoHTML = Replace(RangetoHTML, "align=center x:publishsource=", _
"align=left x:publishsource=")
'Close TempWB
TempWB.Close savechanges:=False
'Delete the htm file we used in this function
Kill TempFile
Set ts = Nothing
Set fso = Nothing
Set TempWB = Nothing
End Function