also hab jetzt mal im Forum nach geschaut, bis jetzt sieht es so aus
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim filenum As Integer, iZaehler As Integer, pos As Integer
Dim filename As String, i As String, xlFilename As String
Dim object As NotesEmbeddedObject
Dim row As Integer, written As Integer ,iWCount As Integer
Dim colsum As Currency, colsum2 As Currency, colval As Currency, colname As Currency
Dim Excel As Variant, xlWorkbook As Variant, xlSheet As Variant
Dim pathName As String
Dim cPathname As String
Dim cFilename As String
Dim PathFileName As String
Dim vdoc As NotesDocument
Dim tmpKundennr As String
Set db=session.CurrentDatabase
Set view = db.GetView ("vwKundeKur")
Set doc = New NotesDocument(db)
pathName$ = "E:\TestKUR\Excel\*"
cFilename$ = Dir$(pathName$ & "*.xls", 0)
PathFileName = "E:\TestKUR\Excel\" & cFilename$
Set Excel = CreateObject( "Excel.Application" )
' *** ---------------------- öffnet Excel File ---------------------------
Excel.Visible = False
Excel.Workbooks.Open PathFileName
Set xlWorkbook = Excel.ActiveWorkbook
Set xlSheet = xlWorkbook.Worksheets
Forall xlSheets In xlWorkbook.Worksheets ' *** Bearbeitet alle Sheets in der Excelfile(xlWorkbook)
xlSheets.activate ' *** Holt das aktuelle Worksheet in Bearbeitung
Set xlSheet = xlWorkbook.ActiveSheet ' *** Nur ein Sheet - wird hier definiert
iWCount =iWCount + 1
End Forall
colname = 1
colval = 1
'colsum = 0
'colsum2 = 0
row = 2
'With xlSheet
Open PathFileName For Input As filenum
Seek fileNum,1
Do Until Eof (filenum)
Line Input #filenum, i
If i = "" Then
Goto EndeAlles
End If
tmpKundennr = .Cells( row, 1 ).Value '*** Kundennummer zwischenspeichern
Set vdoc = view.GetDocumentByKey(tmpKundennr)
While Not(vdoc Is Nothing)
doc.fdLayout1 = .Cells( row, 2 ).Value ' *** Layout1
doc.fdLayout2 = .Cells( row, 3 ).Value ' *** Layout2
doc.fdLayoutEnde = .Cells( row, 4 ).Value ' *** LayoutEnde
doc.fdPLPA = .Cells( row, 5 ).Value ' *** PLPA
doc.fdFSPS = .Cells( row, 6 ).Value ' *** FSPS
doc.fdPUNr = .Cells( row, 7 ).Value ' *** PUNr
'Call FillFields(vdoc,i)
Call vdoc.save(False,True)
'End With
Goto NextDoc
Wend
NextDoc:
' *** Disconnecting from Excel...
xlWorkbook.Close False
Excel.Quit
Set Excel = Nothing
Loop
ErrorNext:
Resume Next
ErrorPrint:
Resume Next
EndeAlles:
Exit Sub
End Sub
dass ich hier noch viele Fehler drinnen habe ist mir klar. Ich habe es mir so vorgestellt von der logik. öffne die Excell-Datei lies dir die erste Zeile. Die 1.Spalte ist die Kundennumemr(also mein key) nimm den key...gehe in die Ansicht suche nach dem key und befülle die Felder und abspeichern. Lies dir die zweite Zeile nimm den key und such nochmal in der Ansicht und das solange bis der 1. Sheet fertig ist.