Transfer Data into MS Excel'97 from Lotus Notes 4.X

This agent helps in transfering data from Notes into Excel.It has to be run from a view & can be run either on

selected documents or all documents.


Sub Initialize
Dim fn As String
Dim Lfield As String
Dim Lvalue As String
Dim Status As String
Dim session As New NotesSession
Dim db As NotesDatabase
Dim AllView As NotesView
Dim Doc As NotesDocument
Dim j As Long
Dim dc As NotesDocumentCollection
Dim notesformula As String
Set db = Session.currentdatabase

NotesFormula = "Field form = " & |"Transfer"| ' Name of Form is Transfer

Set dc = db.FTSearch(notesformula,0)

Set doc = dc.getnthdocument(dc.count)

Set xlApp = CreateObject("Excel.application") 'Creates an Excel Object
xlApp.Visible = False
xlApp.Workbooks.Add

xlApp.Range("A1").Select
xlApp.Activecell.FormulaR1C1 = "One" 'One is the name of field on form Transfer
xlApp.Range("B1").Select
xlApp.Activecell.formulaR1c1 = "Two" ' Two is the name of field on form Transfer
xlApp.Range("C1").Select
xlApp.Activecell.formulaR1c1 = "Three"
'Three is the name of field on FormTransfer

For j = 1 To Dc.count
Set doc = dc.getnthdocument(j)
k = j + 1
ExcelARange ="A" & Trim(Str(k))
ExcelBRange = "B" & Trim(Str(k))
ExcelCRange = "C" & Trim(Str(k))
ExcelDRange = "D" & Trim(Str(k))

xlApp.Range(ExcelARange).select
xlApp.Activecell.formulaR1C1 = doc.One(0)
xlApp.Range(ExcelBRange).select
xlApp.Activecell.formulaR1C1 = doc.Two(0)
xlApp.Range(ExcelCRange).select
xlApp.Activecell.formulaR1C1 = doc.Three(0)
xlApp.Range(ExcelDRange).select

Next
On Error Resume Next
Kill "C:\push.xls"
On Error Goto 0
xlapp.activeworkbook.saveas "C:\push.xls" 'A file named push.xls is created in the root directory.
xlapp.activeworkbook.close
Set xlapp = Nothing 'Set the handle back to nothing.
End Sub

This was first published in November 2000

Dig deeper on Domino Resources - Part 6

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.uk

Close