I am currently using the vba code below to send an email update after a change in each cell, however i would like the email update to be sent after the workbook is saved, rather than get alerted after any cell is changed
Private Sub Worksheet_Change(ByVal Target As Range)
Dim nConfirmation As Integer
Dim objNewWorkbook As Excel.Workbook
Dim objNewWorksheet As Excel.Worksheet
Dim objOutlookApp As Object
Dim objMail As Object
nConfirmation = MsgBox("Do you want to send an email notification about the sheet updating now?", vbInformation + vbYesNo, "Mail Sheet Updates")
If nConfirmation = vbYes Then
ActiveWorkbook.Save
On Error Resume Next
Set objOutlookApp = CreateObject("Outlook.Application")
Set objMail = objOutlookApp.CreateItem(olMailItem)
'Change the email details as per your needs
With objMail
.To = "test@Email.com"
.Subject = "Email Notifying Sheet Updates"
.Body = "Hi," & vbCrLf & vbCrLf & "The worksheet " & Chr(34) & ActiveWorkbook.Sheets(1).Name & Chr(34) & " in this Excel workbook attachment is updated."
'Attach this workbook
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim nConfirmation As Integer
Dim objNewWorkbook As Excel.Workbook
Dim objNewWorksheet As Excel.Worksheet
Dim objOutlookApp As Object
Dim objMail As Object
nConfirmation = MsgBox("Do you want to send an email notification about the sheet updating now?", vbInformation + vbYesNo, "Mail Sheet Updates")
If nConfirmation = vbYes Then
ActiveWorkbook.Save
On Error Resume Next
Set objOutlookApp = CreateObject("Outlook.Application")
Set objMail = objOutlookApp.CreateItem(olMailItem)
'Change the email details as per your needs
With objMail
.To = "test@Email.com"
.Subject = "Email Notifying Sheet Updates"
.Body = "Hi," & vbCrLf & vbCrLf & "The worksheet " & Chr(34) & ActiveWorkbook.Sheets(1).Name & Chr(34) & " in this Excel workbook attachment is updated."
'Attach this workbook
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
End If
End Sub