Eric Penfold
Active Member
- Joined
- Nov 19, 2021
- Messages
- 431
- Office Version
- 365
- Platform
- Windows
- Mobile
If the above correct then I need the Email Address to change to relevant Email Address?
VBA Code:
Sub Mail_small_Text_Outlook()
Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
Dim ws As Worksheet
Dim Rng As Range
Dim LRow As Long
Dim Cell As Range
Dim x As String
Dim Found As Boolean
Dim EmailAddress As String
Dim WsConfig As Worksheet
Dim lngStartRow As Long
Set xOutApp = CreateObject("Outlook.Application")
Set xOutMail = xOutApp.CreateItem(0)
Set ws = ThisWorkbook.Worksheets("Data")
Set WsConfig = ThisWorkbook.Worksheets("Config")
LRow = ws.Cells(Rows.Count, 1).End(xlUp).Row
lngStartRow = WsConfig.Range("B1") + 1
x = "ASKWH"
ws.Range("J" & lngStartRow).Select
If ActiveCell.Offset(1, 0) = x Then
Found = True
If Found = True Then
If ActiveCell = x & ActiveCell.Offset(1, 2) = "A" Then
EmailAddress = ("alton@Drainfast.co.uk")
ElseIf ActiveCell = x & ActiveCell.Offset(1, 2) = "B" Then
EmailAddress = ("warehousebas@Drainfast.co.uk")
ElseIf ActiveCell = x & ActiveCell.Offset(1, 2) = "C" Then
EmailAddress = ("warehousecov@Drainfast.co.uk")
End If
End If
End If
xMailBody = "Hi" & vbNewLine & vbNewLine & _
"Do you know why this is a back order? Intact is showing you have the stock?" & vbNewLine & _
"" & vbNewLine & _
" Kind Regards"
On Error Resume Next
With xOutMail
.To = "Email Address"
.CC = ""
.BCC = ""
.Subject = "BO Queries"
.Body = xMailBody
.Display
End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub