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
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
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!