Home / User Contributed Macros / Mail Notification

Mail Notification


The following code is used to send an email if certain values of your worksheet meet the desired criteria. This is useful for collaborative editing and dynamic data.
Private Sub Worksheet_Change(ByVal Target As Range) 
 Application.EnableEvents = false
 On Error Goto ENEV
 If(Target.Address="$C$10" And IsNumeric(Target.Value) And Target.Value>=1000) Then
    ThisWorkbook.HasRoutingSlip = True
    With ThisWorkbook.RoutingSlip
       .Recipients = Array("$mailid") ' Enter mail ids seperated by comma
       .Subject = "$subject"          ' Enter your subject here
       .Message = "$message"          ' Enter your message here 
    End With
    ThisWorkbook.Route
 End If
 ENEV:
Application.EnableEvents = true
End Sub 

    Dave Chlan  04 Jan 2012 
    Thanks for providing this example! Is there a way to send an email without attaching the document?
    Chris O'Leary  09 Jan 2016 
    I would also like to know this as i send the remittance for purchases to suppliers from the sheet and don't want to attach the entire document to them with everyone's details
    Suvarna  12 Sep 2021 
    Is it possible to set .From field in the routingslip option if we want to specify the sender
    Suvarna  12 Sep 2021 
    I am trying to send attachment as per your code but not able to receive it
    Suvarna  12 Sep 2021 
    My code for the attachment is :
    ThisWorkbook.HasRoutingSlip = True
    With ThisWorkbook.RoutingSlip
    '.from = "suvarna.mohite@glogic.co.in"
    .Recipients = "suvarna.mohite@glogic.co.in" 'Can send mail to multiple recepients
    .Subject = "Trial mail from zoho VBA"
    .Message = "Hello! Have a Good Day!! Mail content. " & "Sending trial link here:" & ActiveSheet.Name
    .AttachWorkbook = True
    .SheetName = ActiveSheet.Name ' this will send the active sheet.
    End With
    ThisWorkbook.Route
    Sakthi Kirubakaran M  29 Sep 2021 
    Hi Suvarna,

    Please note that there was an issue attachment in Zoho Sheet which has been fixed by our developers now. You should now be able to send emails with sheet attachments. Please have a check on the same and find it helpful.

    Good day & take care!



     RSS of this page