Veteran
Registriert seit: 18.04.2001
Alter: 49
Beiträge: 283
|
Hab den Agent nochmal reingeklopft:
Sub Initialize
%REM
================================================== ========================================
Es steht jedem frei, dieses Script zu benutzen oder zu verändern, ich übernehme allerdings keinerlei
Verantwortung für eventuell durch diesen Agent verursachte Schäden an Dateien.
Erstellt von TCS am 25.1.2002
Dieser Agent importiert mit Outlook-Express erstellte csv-Files. Dateistruktur:
Name;
E-Mail-Adresse;
Straße (privat);
Ort (privat);
Postleitzahl (privat);
Bundesland (privat);
Land/Region (privat);
Rufnummer (privat);
Straße (geschäftlich);
Ort (geschäftlich);
Postleitzahl (geschäftlich);
Bundesland (geschäftlich);
Land/Region (geschäftlich);
Rufnummer (geschäftlich);
Firma;
Position
%END REM
Const FunctionName="CSV-Import"
Print FunctionName+" START"
Dim s As New notessession
Dim db As notesdatabase
Dim view As notesview
Dim doc As notesdocument
Dim csv As String
Dim zeile As String
Dim fname As String 'FirstName+" "+LastName
Dim mail As String 'MailAddress
Dim homestreet As String 'HomeAddress
Dim homecity As String 'HomeAddress
Dim homezip As String 'Zip
Dim homestate As String 'HomeAddress
Dim homecountry As String 'Country
Dim homephone As String 'PhoneNumber
Dim jobstreet As String 'BusinessAddress
Dim jobcity As String 'Location
Dim jobzip As String 'OfficeZip
Dim jobstate As String 'BusinessAddress
Dim jobcountry As String 'OfficeCountry
Dim jobphone As String 'OfficePhoneNumber
Dim company As String 'CompanyName
Dim jobtitle As String 'JobTitle
Dim firstname As String
Dim lastname As String
Dim key As String
Dim num As Integer
Dim i As Integer
Set db=s.currentdatabase
Set view=db.getview("Kontakte")
csv=Inputbox("Bitte Datei mit gesamtem Pfad angeben!","Auswahl","C:\ADRESS.CSV")
i=0
num=Freefile()
Open csv For Input As num
Do Until Eof(num)
Line Input #num,zeile
If i>0 Then
fname=zeile
mail=Mid$(fname,Instr(fname,";")+1)
homestreet=Mid$(mail,Instr(mail,";")+1)
homecity=Mid$(homestreet,Instr(homestreet,";")+1)
homezip=Mid$(homecity,Instr(homecity,";")+1)
homestate=Mid$(homezip,Instr(homezip,";")+1)
homecountry=Mid$(homestate,Instr(homestate,";")+1)
homephone=Mid$(homecountry,Instr(homecountry,";")+ 1)
jobstreet=Mid$(homephone,Instr(homephone,";")+1)
jobcity=Mid$(jobstreet,Instr(jobstreet,";")+1)
jobzip=Mid$(jobcity,Instr(jobcity,";")+1)
jobstate=Mid$(jobzip,Instr(jobzip,";")+1)
jobcountry=Mid$(jobstate,Instr(jobstate,";")+1)
jobphone=Mid$(jobcountry,Instr(jobcountry,";")+1)
company=Mid$(jobphone,Instr(jobphone,";")+1)
jobtitle=Mid$(company,Instr(company,";")+1)
key=Left$(fname,Instr(fname,";")-1)
If Instr(key," ")<>0 Then
firstname=Left$(fname,Instr(fname," ")-1)
lastname=Mid$(fname,Instr(fname," ")+1)
lastname=Left$(lastname,Instr(lastname,";")-1)
Else
firstname=""
lastname=Left$(fname,Instr(fname,";")-1)
End If
If firstname<>"" Then
key=firstname+" "+lastname
Else
key=lastname
End If
Set doc=view.getdocumentbykey(key)
If doc Is Nothing Then
Set doc=db.createdocument
doc.form="Person"
doc.type="Person"
doc.firstname=firstname
doc.lastname=lastname
doc.mailaddress=Left$(mail,Instr(mail,";")-1)
doc.homeaddress=Left$(homestreet,Instr(homestreet, ";")-1)
Set item=doc.getfirstitem("HomeAddress")
Call item.appendtotextlist(Left$(homecity,Instr(homecit y,";")-1))
Call item.appendtotextlist(Left$(homestate,Instr(homest ate,";")-1))
doc.zip=Left$(homezip,Instr(homezip,";")-1)
doc.country=Left$(homecountry,Instr(homecountry,"; ")-1)
doc.phonenumber=Left$(homephone,Instr(homephone,"; ")-1)
doc.businessaddress=Left$(jobstreet,Instr(jobstree t,";")-1)
Set item=doc.getfirstitem("BusinessAddress")
Call item.appendtotextlist(Left$(jobstate,Instr(jobstat e,";")-1))
doc.location=Left$(jobcity,Instr(jobcity,";")-1)
doc.officezip=Left$(jobzip,Instr(jobzip,";")-1)
doc.officecountry=Left$(jobcountry,Instr(jobcountr y,";")-1)
doc.officephonenumber=Left$(jobphone,Instr(jobphon e,";")-1)
doc.companyname=Left$(company,Instr(company,";")-1)
doc.jobtitle=jobtitle
Call doc.save(True,False)
End If
End If
i=1
Loop
Print FunctionName+" ENDE"
End Sub
Ich hoffe das hilft.
Viele Grüße
TCS
|