AerowindowsRobin
New Member
- Joined
- Oct 1, 2021
- Messages
- 3
- Office Version
- 2019
- Platform
- Windows
Hello,
Below is my VBA code that when a number is above 5 in my "U" column it generates an email to my company. The email of my body currently says "Workflow in the CRF Tracker has passed 5 business days on PO#" and I want it to display the PO# that's in Column "A". Example, if "U5" > 5, an email body would display "Workflow in the CRF Tracker has passed 5 business days on PO#" & [A5].
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("U:U"), Target)
If xRg Is Nothing Then Exit Sub
If IsNumeric(Target.Value) And Target.Value > 5 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)
strbody = "Workflow in the CRF Tracker has passed 5 business days on PO#" & ???
On Error Resume Next
With xOutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "Workflow in CRF"
.HTMLBody = strbody
.Display
End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub
Below is my VBA code that when a number is above 5 in my "U" column it generates an email to my company. The email of my body currently says "Workflow in the CRF Tracker has passed 5 business days on PO#" and I want it to display the PO# that's in Column "A". Example, if "U5" > 5, an email body would display "Workflow in the CRF Tracker has passed 5 business days on PO#" & [A5].
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("U:U"), Target)
If xRg Is Nothing Then Exit Sub
If IsNumeric(Target.Value) And Target.Value > 5 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)
strbody = "Workflow in the CRF Tracker has passed 5 business days on PO#" & ???
On Error Resume Next
With xOutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "Workflow in CRF"
.HTMLBody = strbody
.Display
End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub