X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Embed OLE Object, Office 2013    
post Jun 2 2020, 09:22 AM

UtterAccess VIP
Posts: 1,958
Joined: 9-August 01
From: Belgium

I'm creating a task in Outlook from within Excel using vba.
But is it possible to embed an OLE-object (it's a pdf) into the body of the task?
Code so far:
</div><div>Set objOutlookApp = CreateObject("Outlook.Application")
Set objTask = objOutlookApp.CreateItem(oltaskitem)

objTask.Subject = Range("i5").Text + " - " + Range("b7").Text
objTask.StartDate = Now
objTask.Status = olTaskInProgress
objTask.Body = Cells(16, "A") & vbNewLine
objTask.DueDate = Range("i7").Text



Don't worry, just panic!!!
Go to the top of the page
post Jun 2 2020, 11:03 AM

UtterAccess VIP
Posts: 7,425
Joined: 30-June 11

Don't see why you could use https://docs.microsoft.com/en-us/office/vba...Attachments.Add

Perhaps something like (untested)

objTask.Attachments.Add "C:\...\...\filename.ext", olEmbeddeditem

Daniel Pineault (2010-2020 Microsoft MVP, UA VIP, EE Distinguished Expert 2018)
Professional Help: https://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: https://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc

All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    3rd August 2020 - 09:23 AM