Domino 9 und frühere Versionen > ND6: Entwicklung
Export von Notes to Excel
Christoph.1982:
Hallo,
ich habe folgenden vorliegenden Programmcode in meinem Notes der die Daten in ein Excel Spreasheet exportiert. Es funktioniert auch, aber ich haette noch ein paar fragen dazu:
Vielen herzlichen Dank fuer eure Antworten.
Viele Gruesse Chris
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 Was ist das Nothing? Ist habe mir gedacht, wenn in de Ansicht View nichts ist und dies ist nochmal negiert mit dem not --> Also muss was in dem View sein, damit er weitermacht, ist das richtig?
Set xlApp = createobject("Excel.Application")
xlApp.DisplayAlerts = False
xlApp.Visible = False
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 getFirstEntry? was ist der erste Eintrag in dem View? Erste Spalte und Erste Zeile?
While Not(vE Is Nothing) Wieder gleicher Fall wie oben?
If vE.IsDocument Then
Row = Row + 1 In dieser Schleife habe ich die For Anweisung verstanden, aber die zaehlt doch nur die columns hoch, ich weiss aber leider nicht wie er hier die Rows hochzaehlt, bzw wie das funktioniert, weil oben steht ja Row=Row+1, aber das steht doch in keiner Schleife das es hochzaehlen koennte, oder?
' not the last row
For n = 0 To Ubound(vE.ColumnValues)
xlSheet.Cells(Row, n + 1) = vE.ColumnValues(n) ' to prevent excel errors
Next
End If
Set vE = EC.getNextEntry(vE)
Wend
End If
Call xlWB.SaveAs("C:\PhoneLogServiceFollowUp.xls")
Call xlWB.Close
Call xlApp.Quit
Messagebox "Export successful to C:\PhoneLogServiceFollowUp.xls! Pleae open your Excel file InformationQuotes.xls and update your data.", 64, "Information"
Error_Export:
If (Err <> 0) Then Und das versteh ich auch nicht...Was ist Err, oben ist das doch nirgends als Variable deklariert...und was soll das Aussagen Err<>0?
Messagebox Error$, 48, "An error has occurred..."
End If
Exit Sub
End Sub
klaussal:
--- Zitat ---Also muss was in dem View sein, damit er weitermacht, ist das richtig?
--- Ende Zitat ---
Richtig, View muss vorhanden sein. Mit GetFirstDocument wird gelesen.
--- Zitat ---getFirstEntry? was ist der erste Eintrag in dem View?
--- Ende Zitat ---
Erstes Dokument
--- Zitat ---For n = 0 To Ubound(vE.ColumnValues)
--- Ende Zitat ---
Hier wird hochgezählt.
--- Zitat ---oben ist das doch nirgends als Variable deklariert
--- Ende Zitat ---
Muss man auch nicht unbedingt. Dann legt LoNo autom einen Variant-Wert an.
Am besten lässt Du mal den Debugger mitlaufen. Da sieht man vieles viel schöner.
Driri:
--- Zitat ---st habe mir gedacht, wenn in de Ansicht View nichts ist und dies ist nochmal negiert mit dem not --> Also muss was in dem View sein, damit er weitermacht, ist das richtig?
--- Ende Zitat ---
Die Frage ist nicht eindeutig genug formuliert. Das View-Objekt muß vorhanden sein. Das ist keine Überprüfung, ob sich Dokumente in der View befinden.
koehlerbv:
--- Zitat von: klauss am 10.10.06 - 16:13:45 ---
--- Zitat ---oben ist das doch nirgends als Variable deklariert
--- Ende Zitat ---
Muss man auch nicht unbedingt. Dann legt LoNo autom einen Variant-Wert an.
--- Ende Zitat ---
Err ist keine Variable, sondern die Notes-interne Function, die die aktuelle Fehlernummer zurückgibt.
Bernhard
klaussal:
--- Zitat ---Err ist keine Variable, sondern die Notes-interne Function
--- Ende Zitat ---
Asche auf mein Haupt, schneller geschrieben als gedacht.... :'(
Navigation
[0] Themen-Index
[#] Nächste Seite
Zur normalen Ansicht wechseln