Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting to Lotus Notes

Status
Not open for further replies.

ejgb

Programmer
Oct 24, 2001
41
GB
I am using the code below to connect to a Lotus Notes Client, but when it gets to the Initialize command the error message 'Can't find ID File' appears. I've tried with both with and without the password and the same error message appears.



Dim NotesSess As Object
Dim NotesDBase As Object
Dim oDoc As Object
Dim oItem As Object
Dim direct As Object

Dim Var As Variant
Dim flag As Boolean

Set NotesSess = CreateObject("Lotus.NotesSession")

Call NotesSess.Initialize(mvarPassword)

Set NotesDBase = NotesSess.GetDatabase(mvarMailServer, mvarMailFile)

flag = True
If Not (NotesDBase.IsOpen) Then
MsgBox "Can't open mail file: " & NotesDBase.Server & " " & NotesDBase.FilePath
GoTo exit_SendAttachment
End If

Set oDoc = NotesDBase.CreateDocument
Set oItem = oDoc.CreateRichTextItem("BODY")

Call oItem.AppendText(mvarBody & Chr(13) & Chr(13))

With oDoc
.ReplaceItemValue "SendTo", mvarSendTo
.ReplaceItemValue "CopyTo", mvarCCTo
.ReplaceItemValue "BlindCopyTo", vbNullString
.ReplaceItemValue "Subject", mvarSubject
.ReplaceItemValue "Body", mvarBody
End With

If mvarAttachments <> vbNullString Then
Do Until InStr(1, mvarAttachments, &quot;;&quot;) = 0
Call oItem.EmbedObject(1454, &quot;&quot;, Mid(mvarAttachments, 1, (InStr(1, mvarAttachments, &quot;;&quot;) - 1)))
mvarAttachments = Mid(mvarAttachments, (InStr(1, mvarAttachments, &quot;;&quot;) + 1))
Loop
Call oItem.EmbedObject(1454, &quot;&quot;, mvarAttachments)
End If

oDoc.SaveMessageOnSend = True

oDoc.Send False

exit_SendAttachment:
On Error Resume Next

Set NotesSess = Nothing
Set NotesDBase = Nothing
Set oDoc = Nothing
Set oItem = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top