Dim session As New NotesSession
'Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Dim dateTime As New NotesDateTime(_
Cstr(Datenumber(2000, 5, 1)))
Dim nam As NotesName
'searchFormula$ = {Form = "Project" & ReminderDate = @Today}
searchFormula$ = "Form =Person"
Set excelApplication = CreateObject("Excel.Application")
excelApplication.Visible = True
Set excelWorkbook = excelApplication.Workbooks.Add
Set ExcelSheet = excelWorkbook.Worksheets("Sheet1")
ExcelSheet.Cells(1,1).Value = "Com"
ExcelSheet.Cells(1,2).Value = "Employee"
ExcelSheet.Cells(1,3).Value = "Name"
ExcelSheet.Cells(1,4).Value = "Email"
ExcelSheet.Cells(1,5).Value = "Department"
ExcelSheet.Cells(1,6).Value = "OfficePhoneNumber"
ExcelSheet.Cells(1,7).Value = "MailServer"
ExcelSheet.Cells(1,8).Value = "Mail File"
ExcelSheet.Cells(1,9).Value = "Internet address"
ExcelSheet.Cells(1,10).Value = "Location"
i = 2
Dim db As New NotesDatabase( "your sever name", "names.nsf" )
Set collection = db.Search(searchFormula$, dateTime,0)
Set doc = collection.GetFirstDocument()
While Not(doc Is Nothing)
Set nam = session.CreateName( doc.FullName(0))
REM Returns "Acme"
'Messagebox nam.Organization,, "Organization"
ExcelSheet.Cells(i,1).Value = doc.CompanyName(0)
ExcelSheet.Cells(i,3).Value = doc.FirstName(0) + " " + doc.Lastname(0)
ExcelSheet.Cells(i,4).Value = Lcase(doc.InternetAddress(0))
ExcelSheet.Cells(i,5).Value = doc.Department(0)
ExcelSheet.Cells(i,6).Value = doc.OfficePhoneNumber(0)
ExcelSheet.Cells(i,7).Value = doc.MailServer(0)
ExcelSheet.Cells(i,8).Value = doc.MailFile(0)
ExcelSheet.Cells(i,8).Value = Lcase(doc.InternetAddress(0))
ExcelSheet.Cells(i,10).Value = doc.Location(0)
i = i +1
' End If
Set doc = collection.GetNextDocument(doc)
Wend
Msgbox "Done !........ "
|