Embed and Send HTML report Lotus Notes (1 Viewer)

Jamesss

Registered User.
Local time
Today, 20:01
Joined
Dec 7, 2008
Messages
27
Searched the forum and found a useful thread:
http://www.access-programmers.co.uk/forums/showthread.php?t=131103&highlight=email+lotus+notes

The code provided allows emails to be automatically send via Lotus Notes. However I am having an issue with embedding the HTML format report before it is sent.

Code:
Dim objAttachment As Object
Dim objMailDb As Object
Dim objMailDocument As Object
Dim objEmbedObject As Object
Dim objNotesSession As Object
Dim strMailDbName As String
Dim sstring As String
On Error Resume Next
'Start objNotesSession in Lotus Notes
Set objNotesSession = CreateObject("Notes.NotesSession")
'Open the mail database in Lotus Notes
Set objMailDb = objNotesSession.GETDATABASE("", strMailDbName)
objMailDb.OPENMAIL
'Set up the new mail document
Set objMailDocument = objMailDb.CREATEDOCUMENT
objMailDocument.Form = "Memo"
objMailDocument.sendto = strLotusNotesUserID
objMailDocument.Subject = strMailTitle
objMailDocument.Body = strTextBody
objMailDocument.SAVEMESSAGEONSEND = fSaveMailToTheSentFolder
strFileAttachment = "Rpt_Test"
'Set up the embedded object and strFileAttachment and attach it
[B]If strFileAttachment <> "" Then[/B]
[B]Set objAttachment = objMailDocument.CreateHTMLItem("Rpt_PortsQueryEdit")[/B]
[B]Set objEmbedObject = objAttachment.EmbedObject(1454, "", "C:Rpt_Test.html", "Rpt_Test")[/B]
End If
'Send the document
objMailDocument.SEND 0, strLotusNotesUserID
'Clean Up
Set objMailDb = Nothing
Set objMailDocument = Nothing
Set objAttachment = Nothing
Set objNotesSession = Nothing
Set objEmbedObject = Nothing

It looks like the part of the code where:
Code:
Set objAttachment = objMailDocument.CreateHTMLItem("Rpt_Test")
Set objEmbedObject = objAttachment.EmbedObject(1454, "", "C:Rpt_Test.html", "Rpt_Test")

Is intended to create the attachment and embeds it in the email.

I also tried manually exporting a HTML version ("C:Rpt_Test.html") of the report in the C:/ directory.

Can someone explain the syntax of these object-related commands to help me get it working.

Thanks
 

Jamesss

Registered User.
Local time
Today, 20:01
Joined
Dec 7, 2008
Messages
27
After some further digging. I saw that the directory location required a "\" after the colon. That seems to have allow the file to be attached to the email.

But there is another problem I have found. In lotus notes the file instead of being embedded, is instead attached at the end of the email below a thin black line.

After some more investigation I found some info on this problem from IBM:
http://www-01.ibm.com/support/docview.wss?uid=swg21089682

Where they describe the problem:
"In some cases, when using the EmbedObject method (of the NotesRichTextItem class) to attach a file, the attachment appears at the bottom of the document below a line (also referred to as a V2 style attachment)."

I tried implementing their workaround but I don't think VBA recognizes the defined properties eg Dim uidoc As notesuidocument.

Anyone have a suggestion?

J
 

soccerkingpilot

New member
Local time
Today, 03:01
Joined
Jun 8, 2012
Messages
9
I know this post is very old, but this might help others who are looking at it. In your embedobject command, you're using code 1454. This is for attaching an object. 1453 should be used to embed an object in a message.
 

Users who are viewing this thread

Top Bottom