Das hier in ein Modul (ggf neu erstellen):
Public changed As Boolean
Das hier in das Codemodul des "ersten Blattes":
Private Sub Worksheet_Change(ByVal Target As Range)
changed = False
If Target.Row > 18 Or Target.Column > 1 Then Exit Sub
changed = True
End Sub
Das hier in das Codemodul der Arbeitsmappe:
Private Sub Workbook_AfterSave(ByVal Success As Boolean)
If Not changed Then Exit Sub
Dim xRgSel As Range
Dim xOutApp As Object
Dim xMailItem As Object
Dim xMailBody, xname As String
On Error Resume Next
Application.ScreenUpdating = False
Application.DisplayAlerts = False
xname = ActiveWorkbook.FullName
Set xOutApp = CreateObject("Outlook.Application")
Set xMailItem = xOutApp.CreateItem(0)
With xMailItem
.To = "email"
.CC = ""
.Subject = "The workbook has been saved"
.Body = "Hi," & Chr(13) & Chr(13) & "File is now updated."
.Attachments.Add xname
.Display
'.send
End With
Set xMailItem = Nothing
Set xOutApp = Nothing
End Sub
|