This code is on a form. Two fields provide the pathname of an
input file and the name of an output database. A "Process" button
sets the input and output parameters for a NotesDXLImporter object
and calls its Process method.Dim session As NotesSession
Dim ws As NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim importer As NotesDXLImporter
Dim stream As NotesStream
Dim db As NotesDatabase
Sub Initialize
Set session = New NotesSession
Set ws = New NotesUIWorkspace
Set importer = session.CreateDXLImporter
End Sub
Function SetInput As Boolean
Set stream = session.CreateStream
fileName$ = uidoc.FieldGetText("InputFile")
If Not stream.Open(fileName$) Then
Messagebox "Cannot open file",, fileName$
SetInput = False
Exit Function
End If
If stream.Bytes = 0 Then
Messagebox "File did not exist or was empty",, fileName$
SetInput = False
Exit Function
End If
Call importer.SetInput(stream)
SetInput = True
End Function
Function SetOutput As Boolean
Set db = New NotesDatabase("", "")
fileName$ = uidoc.FieldGetText("OutputDatabase")
If Not db.Open("", fileName$) Then
Call db.Create("", fileName$, True)
End If
Call importer.SetOutput(db)
SetOutput = True
End Function
Sub Postopen(Source As Notesuidocument)
Set uidoc = ws.CurrentDocument
End Sub
Sub Click(Source As Button)
REM This is the "Process" button
If Not SetInput Then Exit Sub
If Not SetOutput Then Exit Sub
Call importer.Process
End Sub