Hi guys,
I want to use the code below in Excel VBA to grab names from our names.nsf file on our Lotus Notes server. I have done it successfully, but I don’t want to prompt my user for a password if they already have Notes open (which it is likely they will). Is there anyway around this without having to late bind everything? If not, how do I go about late binding this without getting errors?
Sub GetNamesFromLotusNotes()
'Make sure that the Lotus Domino Objects are turned on
Dim ses As Domino.NotesSession, db As Domino.NotesDatabase, view As Domino.NotesView
Dim doc As Domino.NotesDocument, item As Domino.NotesItem
Dim email As String, var As Variant, Names As String, x As Integer
Set ses = CreateObject(“lotus.NotesSession”)
ses.Initialize
Set db = ses.GetDatabase(“MAS-NS1/MAS/DCC”, “names.nsf”)
Set view = db.GetView(“People\By Employee ID”)
x = view.FTSearch(“EngCQA”, 0)
Set doc = view.GetFirstDocument
While Not (doc Is Nothing)
For Each var In doc.Items
If var.Name = "FirstName" Then
email = var.Text & " "
Exit For
End If
Next var
For Each var In doc.Items
If var.Name = "LastName" Then
email = email & var.Text & ","
Exit For
End If
Next var
Names = Names + email
Set doc = view.GetNextDocument(doc)
Wend
EndTest:
Set item = Nothing
Set doc = Nothing
Set view = Nothing
Set db = Nothing
Set ses = Nothing
End Sub