cancel
Showing results for 
Search instead for 
Did you mean: 

Outlook 2016 Object - Send Mail Code Stage

CalinSandulescu
Level 2
Hi everyone, I have the following code that works perfectly as an excel macro: Dim objOutlook As Object Dim objMail As Object Dim aPath As String Dim CRLFLF As String Dim CRLF As String CRLFLF = Chr(10) & Chr(13) & Chr(10) & Chr(13) CRLF = Chr(10) & Chr(13) Set objOutlook = CreateObject("Outlook.Application") Set objMail = objOutlook.CreateItem(0) aPath = "Bla Bla Path" With objMail    .BodyFormat = 1    .To = "mail1"    .CC = "mail2"    .Subject = "Hobby Request"    .Body = "Dear all " & CRLF & "Please list 5 Hobbys " & CRLF & "Best Regards" & Chr(10) & Environ("USERNAME")    .Attachments.Add aPath    .Display End With   When I transfer it to BluePrism it doesn't work anymore throwing the following error: "Internal : Exception: Object reference not set to an instance of an object." I've set the global variables in the initialise page, I know that "Set and Let are not supported" but still doesn't work. The Language is set to Visual Basic, the internal references are : "System.dll, System.Data.dll, System.Xml.dll, System.Drawing.dll" and Namespace Imports are: "System, System.Drawing,System.Data" Can someone please help me with this issue. Thank you in advance!  
1 REPLY 1

John__Carter
Staff
Staff
Could be the CreateObject line is failing. Try referencing C:\Program Files (x86)\Microsoft Office\root\Microsoft.Office.Interop.Outlook.dll