Hi all,
I'm looking to insert an image from file source "D:\users\Owen\Desktop\Test\IMG_123.jpg" into my msg.body. Is there a way this can be done?
I'm looking to insert an image from file source "D:\users\Owen\Desktop\Test\IMG_123.jpg" into my msg.body. Is there a way this can be done?
Code:
Sub Send_email()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("email")
Dim Outlook As Object
Dim msg As Object
Set Outlook = CreateObject("outlook.application")
Dim i As Integer
Dim last_row As Integer
Dim p As String
last_row = Application.WorksheetFunction.CountA(sh.Range("B:B"))
For i = 2 To last_row
Set msg = Outlook.createitem(0)
If sh.Range("E" & i) = "" Then
msg.To = sh.Range("B" & i).Value
msg.bcc = sh.Range("C" & i).Value
msg.Subject = "Request Status"
If sh.Range("D" & I) = "Declined" Then
If sh.Range("G" & I) = "Brand1" Then
msg.body = "Thank you for contacting Brand1" & vbCrLf & vbCrLf & "I'm contacting you in regards to " & sh.Range("F" & I).Value
ElseIf sh.Range("G" & I) = "Brand2" Then
msg.body = "Thank you for contacting Brand2" & vbCrLf & vbCrLf & "I'm contacting you in regards to " & sh.Range("F" & I).Value
ElseIf sh.Range("G" & I) = "Brand3" Then
msg.body = "Thank you for contacting Brand3" & vbCrLf & vbCrLf & "I'm contacting you in regards to " & sh.Range("F" & I).Value
End If
ElseIf sh.Range("D" & I) = "Approved" Then
If sh.Range("G" & I) = "Brand1" Then
msg.body = "Dear " & sh.Range("A" & I).Value & vbCrLf & vbCrLf & "I'm contacting you in regards to " & sh.Range("F" & I).Value
ElseIf sh.Range("G" & I) = "Brand2" Then
msg.body = "Dear " & sh.Range("A" & I).Value & vbCrLf & vbCrLf & "I'm contacting you in regards to " & sh.Range("F" & I).Value
ElseIf sh.Range("G" & I) = "Brand3" Then
msg.body = "Dear " & sh.Range("A" & I).Value & vbCrLf & vbCrLf & "I'm contacting you in regards to " & sh.Range("F" & I).Value
End If
End If
msg.display
If sh.Range("E" & i).Value = "Sent" Then
Else
sh.Range("E" & i) = "Sent"
End If
End If
Next i
MsgBox "Email has been sent"
Last edited: