Created
June 10, 2019 08:58
-
-
Save DataSolveProblems/d92fb0c08dd68d08b73aeb2b9ac4b203 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) | |
Call Send_Email | |
End Sub | |
Private Sub Send_Email() | |
Dim olNS As Namespace | |
Dim olMail As MailItem | |
Set olNS = GetNamespace("MAPI") | |
Set olMail = CreateItem(olMailItem) | |
With olMail | |
.Subject = "Excel File XYZ Saved by " & Application.UserName | |
.To = "[email protected]" | |
.Body = "Excel file was saved by " & Application.UserName & " on " & Format(Now(), "mm-dd-yyyy") & " at " & Format(Now(), "hh:mm:ss AM/PM") | |
.SendUsingAccount = olNS.Accounts.Item(1) | |
.Send | |
End With | |
Set olMail = Nothing | |
Set olNS = Nothing | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment