Hi
I just learned VBA, I made code like this
Dim xRg As Range
'Update by Extendoffice 2018/3/7
Private Sub Worksheet_Change (ByVal Target As Range)
On Error Resume Next
If Target.Cells.Count> 1 Then Exit Sub
Set xRg = Intersect (Range ("c4"), Target)
If xRg Is Nothing Then Exit Sub
If IsNumeric (Target.Value) And Target.Value <1 Then
Call Mail_small_Text_Outlook
End If
End Sub
Sub Mail_small_Text_Outlook ()
Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
Set xOutApp = CreateObject ("Outlook.Application")
Set xOutMail = xOutApp.CreateItem (0)
xMailBody = "Dear Mr. Tian," & vbNewLine & vbNewLine & _
"order duct tape, 10 pcs remaining duct tape, the stock is not safe" & vbNewLine & _
"thank you"
On Error Resume Next
With xOutMail
.To = "toni@email.com"
.CC = "marko@email.com"
.BCC = ""
.Subject = "order duct tape"
.Body = xMailBody
.Display 'or use .Send
End with
On GoTo Error 0
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub
the above code goes well, the code above is only for one cell (C4), how do i make the formula so that if the other cell is changed then send an email also with a different recipient
Please help
I just learned VBA, I made code like this
Dim xRg As Range
'Update by Extendoffice 2018/3/7
Private Sub Worksheet_Change (ByVal Target As Range)
On Error Resume Next
If Target.Cells.Count> 1 Then Exit Sub
Set xRg = Intersect (Range ("c4"), Target)
If xRg Is Nothing Then Exit Sub
If IsNumeric (Target.Value) And Target.Value <1 Then
Call Mail_small_Text_Outlook
End If
End Sub
Sub Mail_small_Text_Outlook ()
Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
Set xOutApp = CreateObject ("Outlook.Application")
Set xOutMail = xOutApp.CreateItem (0)
xMailBody = "Dear Mr. Tian," & vbNewLine & vbNewLine & _
"order duct tape, 10 pcs remaining duct tape, the stock is not safe" & vbNewLine & _
"thank you"
On Error Resume Next
With xOutMail
.To = "toni@email.com"
.CC = "marko@email.com"
.BCC = ""
.Subject = "order duct tape"
.Body = xMailBody
.Display 'or use .Send
End with
On GoTo Error 0
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub
the above code goes well, the code above is only for one cell (C4), how do i make the formula so that if the other cell is changed then send an email also with a different recipient
Please help