Subject: here is my code to do this…
Place the following in the appropraite events of an action…
Options
Option Public
Option Declare
Declarations
Dim xlApp As Variant
Dim xlWb As Variant
Dim xlWs As Variant
Initialize
Sub Initialize
’ Create a document collection from selected docs
’ Move doc collection to a folder
’ Process items in the folder as a view entry
’ Remove from folder
Dim session As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim view As NotesView
Dim vc As NotesViewEntryCollection
Dim entry As NotesViewEntry
Dim doc As NotesDocument
Dim x As Integer
Dim cp As Integer ' used to count the offset position of the columns
x=1 ' used to count the number of the selected document
cp=0
Set db = session.CurrentDatabase
If (db Is Nothing) Then Goto endofsub
Set dc = db.UnprocessedDocuments ' gets a handle on the documents you selected
’ since selected documents are not processed in the order that they are displayed in the view
’ i move the selected documents to their own “sorted” folder, and then process all of them from there
Call dc.PutAllInFolder( "temp" ) ' moves those selected documents into a folder
Set view = db.GetView("temp")
Set vc = view.AllEntries ' gets a handle on all the documents in the folder
’ Get a handle on the required Excel Objects
Set xlApp = CreateObject("excel.application")
Set xlWb = xlApp.WorkBooks.Add()
Set xlWs = xlWb.WorkSheets.Add()
xlApp.Visible = True
If vc.Count = 0 Then
Messagebox "You must select at least one document"
Goto EndOfSub
End If
’ Add view column titles
Forall columns In view.Columns
xlWs.Range("A1").OffSet(0,cp).Font.Bold=True ' make bold
xlWs.Range("A1").OffSet(0,cp).HorizontalAlignment = 3 'center in cell
xlWs.Range("A1").OffSet(0,cp).value=columns.Title
cp=cp+1
End Forall
’ Add data from selected documents to Excel
For x = 1 To vc.Count
Set entry = vc.GetNthEntry(x)
cp=0 ' reset the column position
xlWs.Range("A1").OffSet(x,0).Font.Bold = True ' make the row titles (column 1) bold
Forall columns In entry.ColumnValues
If Not cp = 0 Then ' format all the columns but the first one
xlWs.Range("A1").OffSet(x,cp).NumberFormat = "0.00"
End If
xlWs.Range("A1").OffSet(x,cp).value=columns
cp= cp + 1
End Forall
Next
xlWs. Columns("A:A").EntireColumn.AutoFit
Call dc.RemoveAllFromFolder( "temp" )
Print "Done processing " & vc.count & " documents."
endofsub:
’ place any wrap up stuff here
End Sub
Terminate
xlApp.DisplayAlerts = False
xlApp.Quit ’ use the Quit method to close
Set xlApp = Nothing ’ release the reference.