Kimberly47
New Member
- Joined
- Sep 28, 2018
- Messages
- 2
[FONT="]I have a code to autogenerate an email if an change is made to cells e11:a33. If I make several changes, I'd only like it to autogenerate the email once. How can I do this? Thanks, [/FONT]
[FONT="]Dim xRg As Range[/FONT]
[FONT="]'Update by Extendoffice 2018/3/7[/FONT]
[FONT="]Private Sub Worksheet_Change(ByVal Target As Range)[/FONT]
[FONT="]'Determine if change was made to cells E11:E33[/FONT]
[FONT="]If Not Intersect(Target, Range("E11:E33")) Is Nothing Then[/FONT]
[FONT="]Call Mail_small_Text_Outlook[/FONT]
[FONT="]End If[/FONT]
[FONT="]End Sub[/FONT]
[FONT="]Sub Mail_small_Text_Outlook()[/FONT]
[FONT="]Dim xOutApp As Object[/FONT]
[FONT="]Dim xOutMail As Object[/FONT]
[FONT="]Dim xMailBody As String[/FONT]
[FONT="]Set xOutApp = CreateObject("Outlook.Application")[/FONT]
[FONT="]Set xOutMail = xOutApp.CreateItem(0)[/FONT]
[FONT="]xMailBody = "LAC team," & vbNewLine & vbNewLine & _[/FONT]
[FONT="]"This LAC Event Management Macro for _ has a status update. Please review. Thanks."[/FONT]
[FONT="]On Error Resume Next[/FONT]
[FONT="]With xOutMail[/FONT]
[FONT="].To = ""[/FONT]
[FONT="].CC = ""[/FONT]
[FONT="].BCC = ""[/FONT]
[FONT="].Subject = "Event Planning Update"[/FONT]
[FONT="].Body = xMailBody[/FONT]
[FONT="].Display 'or use .Send[/FONT]
[FONT="]End With[/FONT]
[FONT="]On Error GoTo 0[/FONT]
[FONT="]Set xOutMail = Nothing[/FONT]
[FONT="]Set xOutApp = Nothing[/FONT]
[FONT="]End Sub[/FONT]
[FONT="]Dim xRg As Range[/FONT]
[FONT="]'Update by Extendoffice 2018/3/7[/FONT]
[FONT="]Private Sub Worksheet_Change(ByVal Target As Range)[/FONT]
[FONT="]'Determine if change was made to cells E11:E33[/FONT]
[FONT="]If Not Intersect(Target, Range("E11:E33")) Is Nothing Then[/FONT]
[FONT="]Call Mail_small_Text_Outlook[/FONT]
[FONT="]End If[/FONT]
[FONT="]End Sub[/FONT]
[FONT="]Sub Mail_small_Text_Outlook()[/FONT]
[FONT="]Dim xOutApp As Object[/FONT]
[FONT="]Dim xOutMail As Object[/FONT]
[FONT="]Dim xMailBody As String[/FONT]
[FONT="]Set xOutApp = CreateObject("Outlook.Application")[/FONT]
[FONT="]Set xOutMail = xOutApp.CreateItem(0)[/FONT]
[FONT="]xMailBody = "LAC team," & vbNewLine & vbNewLine & _[/FONT]
[FONT="]"This LAC Event Management Macro for _ has a status update. Please review. Thanks."[/FONT]
[FONT="]On Error Resume Next[/FONT]
[FONT="]With xOutMail[/FONT]
[FONT="].To = ""[/FONT]
[FONT="].CC = ""[/FONT]
[FONT="].BCC = ""[/FONT]
[FONT="].Subject = "Event Planning Update"[/FONT]
[FONT="].Body = xMailBody[/FONT]
[FONT="].Display 'or use .Send[/FONT]
[FONT="]End With[/FONT]
[FONT="]On Error GoTo 0[/FONT]
[FONT="]Set xOutMail = Nothing[/FONT]
[FONT="]Set xOutApp = Nothing[/FONT]
[FONT="]End Sub[/FONT]