I have written code to attach a range which I have named Journals on sheet "Data"
The range name for "Journals is A20:D24
When running the macro, the workbook close and the sheet for the range "Journals" is not attached
It would be appreciated if someone could check my code and kindly amend it
Sub Email_Journal()
Dim File As String, strBody As String
Application.ScreenUpdating = False
Application.DisplayAlerts = False
File = Environ$("temp") & ".xlsx"
strBody = "Hi " & Sheets("Data").Range("AT1") & vbNewLine & vbNewLine & _
"Attached, please find Journal Entries to be printed" & vbNewLine & vbNewLine & _
"Regards" & vbNewLine & vbNewLine & _
"Howard"
Set Rng = Nothing
Sheets("Data").Range("Journals").Copy
With ActiveWorkbook
.SaveAs Filename:=File, FileFormat:=51
.Close savechanges:=False
End With
With CreateObject("Outlook.Application").CreateItem(0)
.Display
.To = Join(Application.Transpose(Sheets("Data").Range("AU1:AU2").Value), ";")
.Subject = Sheets("Data").Range("a42")
.body = strBody
.Attachments.Add File
End With
Kill File
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
Bookmarks