Brian R Armstrong
Board Regular
- Joined
- Jun 5, 2007
- Messages
- 92
Appreciate some help please - I use the code below to email from Excel to Outlook, which works fine.
I would like to add a Picture to the message and I added 2 lines (2) marked xxxx
I now get an error message
Some error occurred 438
Object doesn't support this property or method.
Can anybody spot my error or amend code if possible
Excel 2016, Windows 10
Many Thanks Brian A
Option Explicit
Sub Mail_with_outlook2() ' use this
Dim OutApp As Object
Dim OutMail As Object
Dim strto As String, strcc As String, strbcc As String
Dim strsub As String, strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strto = Cells(FormulaCell.Row, "j").Value 'email address
strcc = " "
strbcc = ""
strsub = "XXXXXX"
strbody = "Hello " & Cells(FormulaCell.Row, "B").Value & vbNewLine & vbNewLine & _
"Some txt ……………………..." & vbNewLine & vbNewLine & _
With OutMail
.To = strto
.CC = strcc
.BCC = strbcc
.Subject = strsub
.Body = strbody
xxxx 'Add file to the email
xxxx .Picture.Add ("C:\Users\Main User\Documents\ROLL-MEMBER.jpg - photos")
.Display ' or use .Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
I would like to add a Picture to the message and I added 2 lines (2) marked xxxx
I now get an error message
Some error occurred 438
Object doesn't support this property or method.
Can anybody spot my error or amend code if possible
Excel 2016, Windows 10
Many Thanks Brian A
Option Explicit
Sub Mail_with_outlook2() ' use this
Dim OutApp As Object
Dim OutMail As Object
Dim strto As String, strcc As String, strbcc As String
Dim strsub As String, strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strto = Cells(FormulaCell.Row, "j").Value 'email address
strcc = " "
strbcc = ""
strsub = "XXXXXX"
strbody = "Hello " & Cells(FormulaCell.Row, "B").Value & vbNewLine & vbNewLine & _
"Some txt ……………………..." & vbNewLine & vbNewLine & _
With OutMail
.To = strto
.CC = strcc
.BCC = strbcc
.Subject = strsub
.Body = strbody
xxxx 'Add file to the email
xxxx .Picture.Add ("C:\Users\Main User\Documents\ROLL-MEMBER.jpg - photos")
.Display ' or use .Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub