Creating an object in Outlook

J

Jean-Marc

Bonjour,

I'm using EXCEL to send a email and insert a object into this email!
With the mouse, the actions was:
Insert
Object
From file
(set the file name)
OK


I'm able to add an attachement file but not a file as an object
(object file: I want an Excel workbook in the body of my email to allow the
user to change any value and saw the value update)
This is my actual code:

'Create a new Workbook Containing 1 Sheet (left most) _
and sends as attachment.

Dim lig As Integer
Dim col As Integer
Dim ol As New Outlook.Application
Dim olmail As MailItem

Dim name As String
Dim emails As String
Dim Subject As String

emails = Range("I3")
Subject = Range("I4")
name = Application.ActiveWorkbook.FullName



Set ol = New Outlook.Application
Set olmail = ol.CreateItem(olMailItem)

With olmail
..Display '.Display Send
..BodyFormat = olFormatRichText
..Body = "Mon message"

.Attachments.Add name, olOLE, , _
"OLE Attachment" ' OLE attachment


..To = emails 'en B3 l'adresse destinataire
..Subject = Subject 'ici le sujet
'.HTMLBody = RangetoHTML(Msg) 'ici le texte de A7:G24


End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top