This tip is very simple but it may help you to export your data to MS Excel. The whole trick is that you can create a simple text file that writes your data in a format that divides each entry with one tab. If you rename this file to *.xls, then everybody can open it with MS Excel WITHOUT any message. Each line of the text file will be a line in the first sheet in Excel and each tab in this line will be in the next column.
Advantages of such a solution:
1. You don't have to use OLE and start MS Excel.
2. Creating a text file is much faster than using OLE.
3. Such an export will also work on machines where MS Excel is not installed.
4. You can use this method for web-clients because you can let a server-side-agent run. As a result, it creates a text file but you should not try it with OLE.
The disadvantage is that you cannot do any text formatting and you cannot place it to another sheet in MS Excel.
The sample script is from a web-agent that creates the text file from a document collection. It then places this file into a new document.
Function ExportDocumentCollection (DocColl As NotesDocument ) As Integer
Dim Doc As NotesDocument
Dim ResultDoc As NotesDocument
Dim FilePath As String
Dim RTITem As NotesRichTextItem
Dim Object As NotesEmbeddedObject
Dim LineText As String
Dim i As Double
Open FilePath For Output As 1 For i=1 To DocColl.Count
Set Doc = DocColl.GetNthDocument(i)
LineText = Doc.Field1(0) & Chr(009) & Doc.Field2(0) & Chr(009) & Doc.Field2(0)
Print #1, LineText
Next Close 1 Set ResultDoc = Doc.ParentDatabase.CreateDocument
ResultDoc.Form = "Result"
Set RTItem = New NotesRichTextItem(ResultDoc , "Export" )
Set Object = RTitem.EmbedObject ( EMBED_ATTACHMENT, "", FilePath)
Kill FilePath End Function