MCTampa
Board Regular
- Joined
- Apr 14, 2016
- Messages
- 97
All,
I am using the following script to send a notification email to my team when a report is updated:
Here is the issue - I created the report, so I had the body of the email end with "Regards, Mike".
However I have handed this report off to other members of the team. When they run the report and send it, it still says "Regards, Mike".
I would like the body to read who the sender is - I assume based on the from address - and have the body say "Regards, Kristine" or "Regards, Ana".
Is this even possible? I would think I need to make the sender a variable, but I do not know how to do that.
Thanks,
Mike
I am using the following script to send a notification email to my team when a report is updated:
Rich (BB code):
Sub Make_Outlook_Mail_With_File_Link()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
If ActiveWorkbook.Path <> "" Then
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "<font size=""3"" face=""Calibri"">" & _
"Team,<br><br>" & _
"The Mid-Day Getaway Report has been updated and can be found here:<br><B>" & _
ActiveWorkbook.Name & "</B> is created.<br>" & _
"Click on this link to open the file : " & _
"<A HREF=""file://" & ActiveWorkbook.FullName & _
""">O:\report</A>" & _
"<br>Regards,<br>" & _
"<br>Mike<br></font>"
On Error Resume Next
With OutMail
.To = user@domain.com
.CC = ""
.BCC = ""
.Subject = "Mid-Day Report Updated:" & " " & Format$(Date, Now)
.HTMLBody = strbody
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Else
MsgBox "The ActiveWorkbook does not have a path, Save the file first."
End If
End Sub
However I have handed this report off to other members of the team. When they run the report and send it, it still says "Regards, Mike".
I would like the body to read who the sender is - I assume based on the from address - and have the body say "Regards, Kristine" or "Regards, Ana".
Is this even possible? I would think I need to make the sender a variable, but I do not know how to do that.
Thanks,
Mike
Last edited by a moderator: