This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
Subject: Automation object error on Outlook.Application, MailItem.Display()
Feedback Type: Problem
Product Area: Notes Client
Technical Area: Application Development
Platform: Windows
Release: 8.5.3
Reproducible: Always
I've been trying to automate creation of new Outlook mail from Lotus Notes.
My problem is Notes gives "Automation object error" when I try to display newly created Outlook mail (MailItem.Display()).
If I use MailItem.Display(Modal=True) and send the new email, there is NO ERROR.
If I use MailItem.Display(Modal=True) but close the new instead of sending it, error is displayed.
If I use MailItem.Display(Modal=False), error is displayed whether the email is sent or not
Anybody has any idea what's going on?
Btw, the code does not give an error if I run it using VBA on Excel.
Thank you!
Below is the code I'm using:
Sub AutomateOutlook(sendTo As Variant, copyTo As Variant, subject As Variant, message As Variant, link As String)
Set appOutl = CreateObject("Outlook.Application")
Set myNameSpace = appOutl.GetNameSpace("MAPI")
Dim maiMail As Variant
Set maiMail = appOutl.CreateItem(olMailItem)
With maiMail
'add recipients
'add cc recipients
.Recipients.ResolveAll
'Set body format to HTML
'Set HTML body
'Display Mail Model to user
.Display() 'Automation object error
End With
' Close object references.
Set appOutl = Nothing
Set maiMail = Nothing
Set sendTo = Nothing
End Sub
Feedback number WEBB95K47Y created by ~Vijay Dwojumizenettu on 03/07/2013
Status: Open
Comments: