Email problem with Lotus Notes

Sprocket

Registered User.
Local time
Today, 08:33
Joined
Mar 15, 2002
Messages
70
I have a report that contains check boxes that I want to email to colleagues within the same company. In order for the report to maintain its format and display the checkmarks I am using a snapshot. My problem is that I just can't get Lotus Notes to open.

I know Access wants to use Outlook but we don't use that - nothings simple is it.

Ive tried the mailto route - No luck.

I've tried the send object route - No luck either as it doesn't recognise Notes as an object.

What I've resorted to is the following I have a button on the report which creates a snapshot and puts a copy of the snapshot into a sub-folder. I then email this as an attachment - having open up Lotus Notes manually.

It works but it's very scrappy.

There must be a better way but I can't find it.

Any ideas greatfully received.


The button has the following code.

Dim stDocName As String
Dim stFileName As String
Dim P1 As String
Dim P2 As String
Dim myName
Dim myPath
Me.Refresh
' myPath - identifies which faculty to send the report to

myPath = Me.FAC_INITIAL

' myName - filename for the snapshot file uses the student number from the form and add the file type extension.

P1 = Me.STUDENT_NUMBER
P2 = ".snp"
myName = P1 & P2

stDocName = "EmailFacultyForm"

DoCmd.OutputTo acOutputReport, stDocName, acFormatSNP, "c:\EmailForms\" & myPath & "\" & myName

Exit_SendAsEmail_Click:

Exit Sub

Err_SendAsEmail_Click:
MsgBox Err.Description
Resume Exit_SendAsEmail_Click

End Sub
 
I personally don't use Lotus Notes, but like many popular programs I assumed that it supported OLE Automation. I did a quick Search on the internet and found this site:

http://www.lotus.com/developers/devbase.nsf/data/document1719

It contain's a word document that shows an example of OLE Automation for Lotus Notes to Send an email from Excel. The same concept would work in Access.

This should be a good place for you to start.

Peace
 
How to email using Lotus Notes

Here's what I use.... but you MUST have Lotus Notes opened and be in the inbox with no password or NewMail dialogue for the onclick command to work with no errors...

Set objNotesWS = CreateObject("Notes.NotesUIWorkspace")

Set notesdb = objNotesWS.COMPOSEDOCUMENT(, , "memo")

strAddressee = "emailaddresses"
strSubject = "subject"
strBody = "body"

notesdb.FIELDSETTEXT "EnterSendTo", strAddressee
notesdb.FIELDSETTEXT "Subject", strSubject
notesdb.FIELDSETTEXT "Body", strBody

notesdb.Send

notesdb.close
Set notesdb = Nothing
Set objNotesWS = Nothing
 
Hi,

I think we could be on the right lines here but I'm a bit lost as how do I get the snapshot report into the body?

I can create it as a seperate document that I can send as an attachment

What would the line of code for an attachment look like?

Many thanks for the help received so far though - I'm learning a lot from you guys.

Sprocket.
 
This code was posted by someone else on this site, and I found it very helpful:

Code:
Public Sub SendNotesMail(Subject As String, Attachment As String, Recipient As String, BodyText As String, SaveIt As Boolean)
'This public sub will send a mail and attachment if neccessary to the recipient including the body text.
'Requires that notes client is installed on the system.

'Set up the objects required for Automation into lotus notes
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim MailDbName As String 'THe current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)

'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")

'Get the sessions username and then calculate the mail file name.
'You may or may not need this as for MailDBname with some systems you can pass an empty string
UserName = Session.UserName
MailDbName = left$(UserName, 1) & right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"

'Open the mail database in notes
Set Maildb = Session.GETDATABASE("", MailDbName)
If Maildb.IsOpen = True Then
'Already open for mail
Else
Maildb.OPENMAIL
End If

'Set up the new mail document
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
MailDoc.SendTo = Recipient
MailDoc.Subject = Subject
MailDoc.Body = BodyText
MailDoc.SaveMessageOnSend = SaveIt

'Set up the embedded object and attachment and attach it
If Attachment <> "" Then
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment, "Attachment")
MailDoc.CREATERICHTEXTITEM ("Attachment")
End If

'Send the document
MailDoc.Send 0, Recipient

'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing

MsgBox "E-mail was sent to " & Recipient & "."
End Sub

Call like this: SendNotesMail "MySubject", "AttachmentPath", "Recipient@aol.com", "BodyText", True
 

Users who are viewing this thread

Back
Top Bottom