Hallo,
ich importiere eine Textdatei mit folgendem Script:
Wenn ich dieses Script nach einem Import nochmal ausführe, mit der gleichen TXT Datei, habe ich alle doppelt. kann ich dies vermeiden?
Sub verr_import(session As NotesSession, ws As NotesUIWorkspace,db As notesDatabase, view As NotesView, doc As NotesDocument)
Dim doc2 As NotesDocument
Dim thr_rec(1 To 6)
' Set view = db.GetView( "()" )
fileNum% = Freefile()
counter% = 0
'Call dir_open (directory)
'Msgbox directory
' filename$= Inputbox$("Bitte Importdatei angeben mit Path?","Importagent","c:\test.txt",200,200)
filename= ws.OpenFileDialog(False, "Bitte Importdatei auswählen !", "", "c:")
If filename(0) ="" Then
Msgbox "Dateiname nicht angeben !"
Exit Sub
End If
Open filename(0) For Input As fileNum%
Do While Not Eof(fileNum%)
Line Input #fileNum%, txt$
counter% = counter% + 1
Loop
Seek fileNum%, 1
For countRec% = 1 To counter%-1
spos=1
epos=1
string1 = ";"
i = 1
j = 6
Line Input #fileNum%, txt$
epos =Instr ( spos, txt$, string1)
Do
length = epos - spos
thr_rec(i)=Trim(Mid (txt$, spos,length))
spos = epos + 1
epos =Instr ( spos, txt$, string1)
i = i+1
Loop Until epos = 0
Set doc = New NotesDocument(db)
doc.Form="#mitarbeiter"
doc.doctype = "Mitarbeiter"
doc.n_name = thr_rec(1)
doc.v_name = thr_rec(2)
doc.kostenst = thr_rec(5)
doc.eintritt = thr_rec(3)
doc.gdatum = thr_rec(4)
doc.Taetigk = thr_rec(6)
Call doc.save(True,True)
Next
Print countRec%
Close fileNum%