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
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