Step 1: Create a New view and name it as "vwStudent" and save some documents using any form.
Step 2: Then create a LotusScript agent and enter the following code.
On Error Goto e
Dim ses As New NotesSession
Dim db As NotesDatabase
Dim uidb As NotesUIDatabase
Dim ndcol As NotesDocumentCollection
Dim doc As NotesDocument
Dim i As Integer
Dim stuname As Variant
Dim sturegno As Variant
Dim department As Variant
Dim batch As Variant
Dim college As Variant
Dim vec As NotesViewEntryCollection
Dim ve As NotesViewEntry
Set db = ses.CurrentDatabase
Set ndcol=db.UnprocessedDocuments
Set doc=ndcol.GetFirstDocument
Dim fileNum As Integer
Dim fileName As String
fileNum = Freefile()
fileName = "C:\Selected.ods"
Open fileName For Output As fileNum
Print #fileNum,"<table>"
Print #fileNum,"<tr><td><b>Student Name</b></td><td><b>Student RegNo</b></td><td><b>Department</b></td><td><b>Batch</b></td><td><b>College Name</b></td></tr>"
While Not(doc Is Nothing)
For i=1 To ndcol.Count
Print #fileNum,"<tr>"
stuname=doc.GetItemValue("stuName") ' field name in the form
sturegno=doc.GetItemValue("stuRegno") ' field name in the form
department=doc.GetItemValue("stuDept") ' field name in the form
batch=doc.GetItemValue("batch") ' field name in the form
college=doc.GetItemValue("college") ' field name in the form
Print #fileNum, "<td>" & stuname(0) & "</td><td>" & sturegno(0) & "</td><td>" & department(0) & "</td><td>" & batch(0) & "</td><td>" & college(0)
Set doc=ndcol.GetNextDocument(doc)
Print #fileNum,"</tr>"
Next i
Print #fileNum,"</table>"
Close fileNum
Msgbox "Report Generated Successfully",,"Successful"
Exit Sub
Wend
Msgbox "Please select some documents"
e:
Msgbox "Line No :" & Erl() & Error()
Exit Sub
Note : 'If u need documents to symphony word just rename the file name as "All Documents.odt"
Step 3: Now create an action button and run that agent through this action button.
Write the following formula in the action button.
@command([ToolsRunMacro];"agentname");
Step 4: Now preview this view in notes and click the action button, it will create the Excel/Word document and Export all documents in the view.
The Agent will crate the symphony Excel/Word file with all documents in table format.
No comments:
Post a Comment