Hallo zusammen,
beim benutzen eines Scriptes um eine Datenbank mit allen Feldern zu Exportieren bekomme ich die Fehlermeldung "Object variable not set".
Ich habe dieses vorhandene Script nur angepasst und keinerlei Erfahrung mit Lotus Script. Hoffe jemand kann mir hier weiterhelfen. Den debugger habe ich auch eingeschaltet, wobei dieser keinerlei Fehler meldet.
Hier der Code:
Sub Click(Source As Button)
'Messagebox("Export momentan nicht möglich")
'vorübergehend auskommentiert am 21.11.2001
Dim Session As New NotesSession
Dim Doc As NotesDocument
Dim CurrDB As NotesDatabase
Dim Collection As NotesDocumentCollection
Dim Application As Variant
Dim Book As Variant
Dim Sheet As Variant
Dim i As Integer
Set CurrDB = Session.CurrentDatabase
Set Collection = CurrDB.UnprocessedDocuments
Set Doc = Collection.GetFirstDocument
Set Book=Nothing
Set Sheet = Nothing
Set Application=Nothing
Set Application = CreateObject("Excel.Application")
Set Book = Application.Workbooks.Add
If Application.Workbooks(1).Worksheets.Count=0 Then
Set sheet = Application.Workbooks(1).Worksheets.Add
End If
Set Sheet = Application.Workbooks(1).Worksheets(1)
Sheet.Name = "Komplett-Export"
Book.Application.Visible=True
ARangeValue = Sheet.Range("A1").Activate
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''' Reiter Allgemein EXCEL '''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sheet.Range("A" & 1).Value = "Anrede"
Sheet.Range("B" & 1).Value = "Titel"
Sheet.Range("C" & 1).Value = "Vorname"
Sheet.Range("D" & 1).Value = "Nachname"
Sheet.Range("E" & 1).Value = "Firma"
Sheet.Range("F" & 1).Value = "Firma 2. Zeile"
Sheet.Range("G" & 1).Value = "Straße"
Sheet.Range("H" & 1).Value = "Plz"
Sheet.Range("I" & 1).Value = "Postfach"
Sheet.Range("J" & 1).Value = "PLZ Postfach"
Sheet.Range("K" & 1).Value = "Ort"
Sheet.Range("L" & 1).Value = "Land"
Sheet.Range("M" & 1).Value = "Telefon Büro"
Sheet.Range("N" & 1).Value = "Fax Büro"
Sheet.Range("O" & 1).Value = "Mobiltelefon"
Sheet.Range("P" & 1).Value = "Berufsbezeichnung"
Sheet.Range("Q" & 1).Value = "Abteilung"
Sheet.Range("R" & 1).Value = "Sekretärin"
Sheet.Range("S" & 1).Value = "Tel-Sekretärin"
Sheet.Range("T" & 1).Value = "E-Mail-Adresse"
Sheet.Range("U" & 1).Value = "Newsletter"
Sheet.Range("V" & 1).Value = "Web-Seite"
Sheet.Range("W" & 1).Value = "Sprache"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''' Reiter Privat EXCEL '''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sheet.Range("X" & 1).Value = "Adresse privat"
Sheet.Range("Y" & 1).Value = "Postfach privat"
Sheet.Range("Z" & 1).Value = "Postleitzahl privat"
Sheet.Range("AA" & 1).Value = "Land privat"
Sheet.Range("AB" & 1).Value = "Telefon privat"
Sheet.Range("AC" & 1).Value = "Fax privat"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''' Reiter Kommentare EXCEL '''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sheet.Range("AD" & 1).Value = "Kommentare"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''' Reiter Erweitert EXCEL '''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sheet.Range("AE" & 1).Value = "Kontakter"
Sheet.Range("AF" & 1).Value = "Kundenbetreuer"
Sheet.Range("AG" & 1).Value = "Kontaktbewertung"
Sheet.Range("AH" & 1).Value = "Geburtstag"
Sheet.Range("AI" & 1).Value = "Kategorien"
Sheet.Range("AJ" & 1).Value = "Kontakter am"
Sheet.Range("AK" & 1).Value = "Kontakter erinnern zwecks"
Sheet.Range("AL" & 1).Value = "Kundenbetreuer am"
Sheet.Range("AM" & 1).Value = "Kundenbetreuer erinnern zwecks"
Sheet.Range("AN" & 1).Value = "Kontaktherkunft"
Sheet.Range("AO" & 1).Value = "Client-Center"
For i = 1 To Collection.Count
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''' Reiter Allgemein LOTUS '''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set item = doc.GetFirstItem ("Title")
Forall iv In item.Values
If Not iv = "" Then
If Not Sheet.Range("A" & i + 1).Value = "" Then
Sheet.Range("A" & i + 1).Value = Sheet.Range("A" & i + 1).Value + ", " + iv
End If
If Sheet.Range("A" & i + 1).Value = "" Then
Sheet.Range("A" & i + 1).Value = iv
End If
End If
End Forall
Sheet.Range("B" & i+1).Value = Doc.Titel
Sheet.Range("C" & i+1).Value = Doc.FirstName
Sheet.Range("D" & i+1).Value = Doc.LastName
Sheet.Range("E" & i+1).Value = Doc.CompanyName
Sheet.Range("F" & i+1).Value = Doc.CompanyName2
Sheet.Range("G" & i+1).Value = Doc.OfficeStreetAddress
Sheet.Range("H" & i+1).Value = Doc.OfficeZip
Sheet.Range("I" & i+1).Value = Doc.Postfach
Sheet.Range("J" & i+1).Value = Doc.PlzPostfach
Sheet.Range("K" & i+1).Value = Doc.OfficeCity
Sheet.Range("L" & i+1).Value = Doc.OfficeCountry
Sheet.Range("M" & i+1).Value = Doc.OfficePhoneNumber
Sheet.Range("N" & i+1).Value = Doc.OfficeFAXPhoneNumber
Sheet.Range("O" & i+1).Value = Doc.CellPhoneNumber
Sheet.Range("P" & i+1).Value = Doc.JobTitle
Sheet.Range("Q" & i+1).Value = Doc.Department
Sheet.Range("R" & i+1).Value = Doc.Sekretar
Sheet.Range("S" & i+1).Value = Doc.Sekrtel
Sheet.Range("T" & i+1).Value = Doc.MailAddress
Sheet.Range("U" & i+1).Value = Doc.Newsticker
Sheet.Range("V" & i+1).Value = Doc.WebSite
Sheet.Range("W" & i+1).Value = Doc.Sprache
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''' Reiter Privat LOTUS '''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sheet.Range("X" & i+1).Value = Doc.HomeAddress
Sheet.Range("Y" & i+1).Value = Doc.Postfachprivat
Sheet.Range("Z" & i+1).Value = Doc.Zip
Sheet.Range("AA" & i+1).Value = Doc.Country
Sheet.Range("AB" & i+1).Value = Doc.PhoneNumber
Sheet.Range("AC" & i+1).Value = Doc.HomeFAXPhoneNumber
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''' Reiter Kommentare LOTUS '''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sheet.Range("AD" & i+1).Value = Doc.Comment
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''' Reiter Erweitert LOTUS '''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set item = doc.GetFirstItem ("Kontakter")
Forall iv In item.Values
If Not iv = "" Then
If Not Sheet.Range("AE" & i + 1).Value = "" Then
Sheet.Range("AE" & i + 1).Value = Sheet.Range("AE" & i + 1).Value + ", " + iv
End If
If Sheet.Range("AE" & i + 1).Value = "" Then
Sheet.Range("AE" & i + 1).Value = iv
End If
End If
End Forall
Set item = doc.GetFirstItem ("Zustandig")
Forall iv In item.Values
If Not iv = "" Then
If Not Sheet.Range("AF" & i + 1).Value = "" Then
Sheet.Range("AF" & i + 1).Value = Sheet.Range("AF" & i + 1).Value + ", " + iv
End If
If Sheet.Range("AF" & i + 1).Value = "" Then
Sheet.Range("AF" & i + 1).Value = iv
End If
End If
End Forall
Set item = doc.GetFirstItem ("Kundenspez")
Forall iv In item.Values
If Not iv = "" Then
If Not Sheet.Range("AG" & i + 1).Value = "" Then
Sheet.Range("AG" & i + 1).Value = Sheet.Range("AG" & i + 1).Value + ", " + iv
End If
If Sheet.Range("AG" & i + 1).Value = "" Then
Sheet.Range("AG" & i + 1).Value = iv
End If
End If
End Forall
Sheet.Range("AH" & i+1).Value = Doc.Birthday
Set item = doc.GetFirstItem ("Categories")
Forall iv In item.Values
If Not iv = "" Then
If Not Sheet.Range("AI" & i + 1).Value = "" Then
Sheet.Range("AI" & i + 1).Value = Sheet.Range("AI" & i + 1).Value + ", " + iv
End If
If Sheet.Range("AI" & i + 1).Value = "" Then
Sheet.Range("AI" & i + 1).Value = iv
End If
End If
End Forall
Sheet.Range("AJ" & i+1).Value =Doc.Erinnerdatek
Set item = doc.GetFirstItem ("Erinnerungk")
Forall iv In item.Values
If Not iv = "" Then
If Not Sheet.Range("AK" & i + 1).Value = "" Then
Sheet.Range("AK" & i + 1).Value = Sheet.Range("AK" & i + 1).Value + ", " + iv
End If
If Sheet.Range("AK" & i + 1).Value = "" Then
Sheet.Range("AK" & i + 1).Value = iv
End If
End If
End Forall
Sheet.Range("AL" & i+1).Value =Doc.Erinnerdate
Set item = doc.GetFirstItem ("Erinnerung")
Forall iv In item.Values
If Not iv = "" Then
If Not Sheet.Range("AM" & i + 1).Value = "" Then
Sheet.Range("AM" & i + 1).Value = Sheet.Range("AM" & i + 1).Value + ", " + iv
End If
If Sheet.Range("AM" & i + 1).Value = "" Then
Sheet.Range("AM" & i + 1).Value = iv
End If
End If
End Forall
Sheet.Range("AN" & i+1).Value = Doc.Kontaktherkunft
Sheet.Range("AO" & i+1).Value = Doc.Clientcenter
Set Doc = Collection.GetNextDocument(Doc)
Next i
End Sub