Hello,
Please see code below. Can you help please with the following.
1. Can I add a .From in the send macro as I want it to come from HRSS@companyname.com and not from my own personal company email address.
2. When the email sends it attaching the Personal.XLSB file and not the spreadsheet that is open.
I have attached the macros before I run the send one.
Sub PJAbsence()
'
' PJAbsence Macro
'
'
Columns("E:L").Select
ActiveWindow.SmallScroll ToRight:=8
Columns("E:Q").Select
ActiveWindow.SmallScroll ToRight:=1
Selection.Delete Shift:=xlToLeft
Range("D24").Select
DirPath = "H:\HR\Reward & Shared Services\Shared Services Only\5 ~ Management Information\4 ~ Weekly Reports\Weekly Absence open ended\Open ended absence"
DateStr = Format(Date, " yyyymmdd")
ActiveWorkbook.SaveAs Filename:=DirPath & DateStr
End Sub
Sub send_Mail()
Dim outlookOBJ As Object
Dim mItem As Object
Set outlookOBJ = CreateObject("Outlook.Application")
Set mItem = outlookOBJ.createitem(olMailItem)
With mItem
.to = "EMAIL ADDRESS"
.Subject = " Absence Report"
.body = "Please find attached Absence Report" & vbCrLf & " Best Regards" & vbCrLf & "HRSS"
.attachments.Add ThisWorkbook.Path & "\" & ThisWorkbook.Name
.Send
End With
End Sub
Thanks
Ross
Bookmarks