macro add a picture to a macro that sends an attachment (lotus notes)

tonkar

New Member
Joined
Feb 3, 2014
Messages
1
Hello,

I managed to grab that piece of code some time ago that sends a mail with attachement to each individual defined in a sheet "parameters". Now, I would like to also add a picture (picture 1) to the body of the same mail; This picture is located in the sheet 1 of the same excel file but have not been successfull

here is the code that I use now

Sub Send_salesreport()
Dim oSess As Object
Dim oDB As Object
Dim oDoc As Object
Dim oItem As Object
Dim direct As Object
Dim Var As Variant
Dim flag As Boolean
Dim DT As String
Dim EM As String

Sheets("Parameters").Select
DT = Cells(6, 2)
EM = Cells(8, 1)

Range("A1").Select
SL = 1

ActiveSheet.Cells(9, 1) = SL
NBSL = ActiveSheet.Cells(10, 1)


For SL = 1 To NBSL

Sheets("Parameters").Select
ActiveSheet.Cells(9, 1) = SL
EM = ActiveSheet.Cells(8, 1)

Set oSess = CreateObject("Notes.NotesSession")
Set oDB = oSess.GetDataBase("", "")
Call oDB.OPENMAIL
flag = True
If Not (oDB.IsOpen) Then flag = oDB.Open("", "")
If Not flag Then
MsgBox "Can't open mail file: " & oDB.SERVER & " " & oDB.FILEPATH
GoTo exit_SendAttachment
End If
On Error GoTo err_handler
'Building Message
Set oDoc = oDB.CreateDocument
Set oItem = oDoc.CreateRichtextitem("BODY")
oDoc.Form = "Memo"
oDoc.Subject = "Daily sales " & DT & ""
oDoc.sendto = EM
oDoc.body =Sheets("summary by entity").Shapes.Range(Array("Picture1"))' tried to paste something there but not successfull....
oDoc.postdate = Date
oDoc.SaveMessageOnSend = True
'Attaching DATABASE
Call oItem.EmbedObject(1454, "", "C:\Daily Sales\daily sales " & DT & " division" & ".xlsx")
oDoc.visable = True
'Sending Message
oDoc.Send False
exit_SendAttachment:
On Error Resume Next
Set oSess = Nothing
Set oDB = Nothing
Set oDoc = Nothing
Set oItem = Nothing
'Done
Next
Exit Sub
err_handler:
If Err.Number = 7225 Then
MsgBox "File doesn't exist"
Else
MsgBox Err.Number & " " & Err.Description
End If
On Error GoTo exit_SendAttachment

End Sub

help would be very appreciated ! thank you.
 

Some videos you may like

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Watch MrExcel Video

Forum statistics

Threads
1,122,521
Messages
5,596,652
Members
414,083
Latest member
Mrsash

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top