justgoertz
New Member
- Joined
- Apr 19, 2016
- Messages
- 2
Hello,
I want that when I save my Excel document that I will receive an email with the content of the sheet. So that I will be notified that changes took place and can visually see which changes are made.
For now I have already created the following VBA:
Option Explicit
Sub Mail_Selection_Range_Outlook_Body()
Dim Sendrng As Range
On Error GoTo StopMacro
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Set Sendrng = Selection(A6)
With Sendrng
ActiveWorkbook.EnvelopeVisible = True
With .Parent.MailEnvelope
.Introduction = "This is a test mail."
With .Item
.To = "just.goertz@hotmail.com"
.CC = ""
.BCC = ""
.Subject = "TEST"
.Send
End With
End With
End With
StopMacro:
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
ActiveWorkbook.EnvelopeVisible = False
End Sub
Now when I run the Macro i will receive the email with the contents of the sheet. That is great. But I want this to happen when I (or somebody else) saves the document/ or makes any changes. Could somebody help me please?
Thank you in advance.
Kind regards,
Justin
I want that when I save my Excel document that I will receive an email with the content of the sheet. So that I will be notified that changes took place and can visually see which changes are made.
For now I have already created the following VBA:
Option Explicit
Sub Mail_Selection_Range_Outlook_Body()
Dim Sendrng As Range
On Error GoTo StopMacro
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Set Sendrng = Selection(A6)
With Sendrng
ActiveWorkbook.EnvelopeVisible = True
With .Parent.MailEnvelope
.Introduction = "This is a test mail."
With .Item
.To = "just.goertz@hotmail.com"
.CC = ""
.BCC = ""
.Subject = "TEST"
.Send
End With
End With
End With
StopMacro:
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
ActiveWorkbook.EnvelopeVisible = False
End Sub
Now when I run the Macro i will receive the email with the contents of the sheet. That is great. But I want this to happen when I (or somebody else) saves the document/ or makes any changes. Could somebody help me please?
Thank you in advance.
Kind regards,
Justin