Smart Tool to customize and export data from multiple NABs

	On Error Resume Next
	Dim xlFilenamei As String
	Dim xlFilenameo As String
	Dim x as integer
	Dim servername
	Dim filename
	Dim DArray
	Dim actRows As Integer
	Dim actColumns As Integer
	Dim Exceli As Variant
	Dim Excelo As Variant
	Dim xlWorkbooki As Variant
	Dim xlWorkbooko As Variant
	Dim xlSheeti As Variant
	Dim xlSheeto As Variant
	Dim object As NotesEmbeddedObject
	Dim i As Integer
	xlFilenamei = "C:\serverlist.xls"
	xlFilenameo = "C:\exporting.xls"
	Set Exceli = CreateObject( "Excel.Application" )
	Set Excelo = CreateObject( "Excel.Application" )
	Exceli.Visible = True               
	Excelo.Visible = True       
	Exceli.Workbooks.Open xlFilenamei
	Excelo.Workbooks.Open xlFilenameo
	Set xlWorkbooki = Exceli.ActiveWorkbook
	Set xlWorkbooko = Excelo.ActiveWorkbook
	Set xlSheeti = xlWorkbooki.ActiveSheet
	Set xlSheeto = xlWorkbooko.ActiveSheet
	Dim cellval As String
	Dim session As New NotesSession
	
	Dim doc As NotesDocument
	
	Dim view As NotesView
	
	
	actRows=3 ' 5 rows Please change this value to number of rows you are having in your excel sheet
	actColumns=2 ' 2 columns.Please change this value to number of rows you are having in your excel sheet

	ReDim DArray(actRows, actColumns) As String
	DArray=xlsheeti.Range("A1").Resize(actRows, actColumns).Value
	i=1
	For x=1 To actRows
		servername=Trim$(CStr(DArray(x,1)))
		filename = Trim$(DArray(x,2))
		Dim db As New NotesDatabase(servername,filename)
		Set view=db.GetView("$People")
		Set doc=view.GetFirstDocument
		
		While Not doc Is Nothing
			
			xlsheeto.Cells(i,1).value=doc.FirstName
			xlsheeto.Cells(i,2).value=doc.LastName
			xlsheeto.Cells(i,3).value=doc.InternetAddress
			
			Set doc=view.GetNextDocument(doc)
			i=i+1
		Wend
	
	Next 
	xlWorkbooko.Close(True)
		
	Exceli.quit
	Excelo.quit
	
	Set Exceli=Nothing
	Set Excelo=Nothing





This tool exports the user details from all person documents of the Domino Directory to an excel file from multiple servers. This reads the list
of servers from an input file serverlist.xls and exports the data in exporting.xls file. Currently this tool exports First Name, Last Name and Internet Address.
However one can change as per the requirement.

LotusScript
Sudhakar K Reddy
July 14, 2015 12:37 AM
Rating
21

All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.



1 comment(s)Login first to comment...
Georgio Sergini
(at 05:17 on 04.10.2016)
Sweet, just what I was looking for! Thanks v.much!