Help with Lotus Notes

L

Lucky1R

I have the following code that I use for sending an email from Lotus Notes
using Access but it will not close Lotus Notes when finished. What have I
left out?

Private Sub CmdMail_Click()

Dim s As Object
Dim db As Object
Dim doc As Object
Dim rtItem As Object
Dim Server As String, Database As String
Dim strError As String

Set s = CreateObject("Notes.NotesSession")
Server = s.GetEnvironmentString("MailServer", True)
Database = s.GetEnvironmentString("MailFile", True)
Set db = s.GetDatabase(Server, Database)

On Error GoTo ErrorLogon
Set doc = db.CreateDocument

On Error GoTo 0

doc.Form = "Memo"
doc.importance = "2"

doc.SendTo = ("John Doe")
doc.ReturnReceipt = "1"
doc.Subject = "Test"

Set rtItem = doc.CreateRichTextItem("Body")

Call rtItem.AppendText("This is a test using the Document Control Database")

Call doc.Send(True)

Set rtItem = Nothing
Set doc = Nothing
Set db = Nothing
Set s = Nothing


ErrorLogon:
If Err.Number = 7063 Then
MsgBox "You must first logon to Lotus Notes"
Set doc = Nothing
Set db = Nothing
Set s = Nothing
Set rtItem = Nothing
End If

Refresh
MsgBox "Your e-mail has been sent!!!"


End Sub
 
L

Lucky1R

I tried those. But seems to say an object is missing no matter where I place
the code. I am beginning to think it is because we go over two different
servers on our network and one passes to the other but will not pass the
close lotus notes code. Thanks for your input TC.
 
T

TC

"Object is missing" (or somesuch) is a programming error. It's nothing
to do with going over different servers.

When you get an error message when you run your code, you need to tell
us (a) exactly what the message is, and (b) show us the line of code
that the error occurs on. Try that now.

HTH,
TC (MVP Access)
http://tc2.atspace.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top