Hallo,
ich hab da ein Problem mit dem Export von Notesdaten nach Excel. Ich verwende folgendes Script.
Sub Click(Source As Button)
Dim Session As New NotesSession
Dim db As NotesDatabase
Dim sourceview As NotesView
Dim sourcedoc As NotesDocument
Dim dataview As NotesView
Dim dc As NotesDocumentCollection
Dim datadoc As NotesDocument
Dim maxcols As Integer
Dim WS As New Notesuiworkspace
Dim UiView As notesuiview
Dim ViewString As String
Dim EnvProfile As String
Set UiView=WS.currentview
ViewString=UiView.viewname
EnvProfile = session.GetEnvironmentString("ReportProfile")
If EnvProfile = "" Then
Messagebox ("Bitte Report Type auswählen.")
Exit Sub
End If
Set db = session.CurrentDatabase
Set sourceview = db.GetView("Profile Name")
Set sourcedoc = sourceview.GetDocumentByKey(EnvProfile)
Set dc = db.unprocesseddocuments
Set dataview = db.getview(ViewString)
Dim xlApp As Variant
Dim xlsheet As Variant
Dim rows As Integer
Dim cols As Integer
rows = 1
cols = 1
max1 = sourcedoc.MaxCols
max2=max1(0)
maxcols=Cint(max2)
Set xlApp = CreateObject("Excel.Application")
xlApp.StatusBar = "Erstelle WorkSheet. Bitte warten"
xlApp.Visible = True
xlApp.Workbooks.Add
xlApp.ReferenceStyle = 2
Set xlsheet = xlApp.Workbooks(1).Worksheets(1)
xlsheet.Name = "Report aus Notes "
xlApp.StatusBar = "Erstelle Spalten Überschrift. Bitte warten"
For x=1 To maxcols
fieldname1 = "Heading" & Trim(Cstr(x))
xlsheet.Cells(rows,cols).Value = sourcedoc.GetItemValue(fieldname1)
cols = cols + 1
Next
Set datadoc = dc.getfirstdocument
Dim fitem As NotesItem
cols=1
rows=2
Do While Not (datadoc Is Nothing)
For x=1 To maxcols
fieldname1 = "Field" & Trim(Cstr(x))
getfield = sourcedoc.GetItemValue(Cvar(fieldname1))
xlsheet.Cells(rows,cols).Value = datadoc.GetItemValue(getfield(0))
cols=cols+1
Next
xlApp.StatusBar = "Importing Notes Data - Document " & rows-1 & " of " & dc.count & "."
rows=rows+1
cols=1
Set datadoc = dc.getnextdocument(datadoc)
Loop
xlApp.Rows("1:1").Select
xlApp.Selection.Font.Bold = True
xlApp.Selection.Font.Underline = True
xlApp.Range(xlsheet.Cells(1,1), xlsheet.Cells(rows,maxcols)).Select
xlApp.Selection.Font.Name = "Arial"
xlApp.Selection.Font.Size = 9
xlApp.Selection.Columns.AutoFit
With xlApp.Worksheets(1)
.PageSetup.Orientation = 2
.PageSetup.centerheader = ". Jour Fixe M II / IT 3 und IT-AmtBw am"
.Pagesetup.RightFooter = "Seite &[Seite]" & Chr$(13) & "Datum: &[Datum]"
.Pagesetup.CenterFooter = ""
End With
xlApp.ReferenceStyle = 1
xlApp.Range("A1").Select
xlApp.StatusBar = "Import der Daten von Lotus Notes Application ist abgeschlossen."
End Sub
Mein Problem ist, das beim Export von Textfeldern aus Notes ab einer bestimmten Größe der Export abgebrochen wird und zwar mit folgender Fehlermeldung aus Notes heraus
Automation object error.
Mit kleineren Feldeinträgen funktioniert der Export gut.
Wer kann mir helfen?