Hallo, hat sich erledigt...habs hinbekommen
ne, also von programmieren hab ich nicht soviel Ahnung, da ich Maschinenbau Student bin...aber ich mache gerade ein Praktika und da muss ich mit LotusNotes arbeiten...
Viele Gruesse Chris
Hier der fuktionierende Code:
Sub Click(Source As Button)
Dim s As New NotesSession
Dim View As NotesView
Dim EC As NotesViewEntryCollection
Dim vE As NotesViewEntry
Dim n As Long
Dim Row As Long
Dim xlApp As Variant
Dim xlWB As Variant
Dim xlSheet As Variant
Dim column As NotesViewColumn
Dim i As Integer
On Error Goto Error_Export
Set View = s.CurrentDatabase.getView("Phone Log / ServiceFollowUp")
If Not(View Is Nothing) Then
Set xlApp = createobject("Excel.Application")
xlApp.StatusBar = "Create WorkSheet. Please wait."
xlApp.DisplayAlerts = False
xlApp.Visible = True
Set xlWB = xlApp.WorkBooks.Add
Set xlSheet = xlWB.Sheets(1)
xlSheet.Name = "MainData"
' write the columnnames
Row = 1
For i = 0 To view.ColumnCount -1
Set column = view.Columns(i)
xlSheet.Cells(Row, i +1) = column.ItemName
Next
' format the columnnames (grey and bold)
xlSheet.Range("A1:AW1").Interior.ColorIndex = 15
xlSheet.Range("A1:AW1").Font.Bold = True
' write the rows
Set EC = View.AllEntries
Set vE =EC.getFirstEntry
Row=0
While (Row <=100)
If vE.IsDocument Then
Row = Row + 1
' not the last row
For n = 0 To Ubound(vE.ColumnValues)
xlSheet.Cells(Row, n + 1) = vE.ColumnValues(n) ' to prevent excel errors
Next
xlApp.StatusBar = "Importing Notes Data"
End If
Set vE = EC.getNextEntry(vE)
Wend
End If
xlApp.Cells.Select
xlApp.Selection.Columns.AutoFit
xlApp.Selection.Rows.AutoFit
xlApp.Range("A1").Select
Call xlWB.SaveAs("C:\PhoneLogServiceFollowUp.xls")
Call xlWB.Close
Call xlApp.Quit
Messagebox "Export successful to C:\PhoneLogServiceFollowUp.xls!", 64, "Information"
Error_Export:
If (Err <> 0) Then
Messagebox Error$, 48, "An error has occurred..."
End If
Exit Sub
End Sub