Domino 9 und frühere Versionen > ND6: Entwicklung

Ansicht mit Daten füllen

<< < (3/7) > >>

klaussal:
Jetzt fange ich mal von vorne an:

Hast Du schon eine Maske erstellt ?
Haben die Felder den gleichen Namen wie die Spalten in EXCEL ?

Ich könnte dir auch eine AKtion schicken, der die ganze Sache importiert. Da lernst Du dann gleichzeitig etwas LS  ;D

Jan Th.:
Die Ansicht wird in einem Frameset geöffnet, aber wie definiere ich den Focus?

Auch eine Maske mit Feldern und der selben Bezeichnung wie die Excel Spalten ist vorhanden.

Das mit dem Agenten wäre ne feine Sache! Ich möchte nur gerne einmal wieder einen Erfolg sehen!

Wilhelm:
Erstelle doch mal in der Ansicht ein Beispieldokument und klicke 1x drauf. Dann hast Du den Fokus in der Ansicht und nicht auf dem aufrufenden Element wie z.B. einem Outline-Entry. Dann sollte es auch mit dem Importieren klappen.

Gruß

Willi

klaussal:
Und hier ist die Aktion:


--- Code: ---Sub Click(Source As Button)

'The action button is located on a view
Dim ws As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase

Dim view As NotesView
Dim doc As NotesDocument
Dim temp1 As String
Dim temp2 As String
Dim temp3 As String
Dim temp4 As String
Dim temp5 As String
Dim temp6 As String
Dim temp7 As String
Dim temp8 As String
Dim temp9 As String


Dim count As Integer
Dim xlApp As Variant
Dim xlSheet As Variant
Dim cursor As Integer
Dim recordcheck As String

On Error Goto ERRORLABEL
Dim FileName As String
Dim DefaultFileName As String
DefaultFileName="C:\Import\Deine Datei.xls"

NamePrompt$="Enter the complete Path and File Name of the Excel file to be imported:" &Chr(13)
FileName=Inputbox(NamePrompt$,"Import File Name Specification",DefaultFileName,100,100)
If FileName="" Then Exit Sub
     'Create an Excel object for the spreadsheet
     'It may be necessary to have the proper MS Office DLLs installed on the PC running this application
     'That is, the person must be able to open the XLS file with Excel
Set xlApp = CreateObject("excel.Application")
xlApp.Application.Workbooks.Open Filename
'File not found will return ERR=213 and the routine will be ended
With xlApp.workbooks.Add
     'Not sure what this line is for, unless it's to be sure that at least one workbook is present in the XLS file
End With
'Stop
Set xlSheet = xlApp.Workbooks(1).Worksheets(1)
recordcheck="x"
r=1 ' Row counter - first row contains fieldnames from the database;
'these fieldnames are not needed as long as the spreadsheet follows a specified format
While recordcheck <>"ENDE"
           'Recordcheck = "0" when there is no value in the first cell of the row,  if integer, or "", if string
           'Important - Set r to a value that will stop the import routine without missing any data, if the other criteria do not
'For this example, six columns are imported
cursor=0
r=r+1
temp1=xlSheet.Cells(r,1).value
recordcheck=Cstr(temp1)
If recordcheck="0" Then Goto Finished ' Avoid generating empty record

temp1=xlSheet.Cells(r,1).value
temp2=xlSheet.Cells(r,2).value
temp3=xlSheet.Cells(r,3).value
temp4=xlSheet.Cells(r,4).value
temp5 =xlSheet.Cells(r,5).value


           'The above lines lines could be combined with those below, but keep separate for ease in debugging until ready to finalize the code
Set doc = New NotesDocument(db)

doc.Form = "DeineForm"

doc.LastName= temp1
doc.FirstName = temp2
doc.Anrede = temp3
doc.other = temp4
doc.Address = temp5
doc.ZIP = temp6
doc.City = temp7

Call Doc.Save(True, False)
count = count + 1

Print "anzahl datensätze: " + Cstr(count)
Finished:
Wend
Goto SubClose

ERRORLABEL:
     'Msgbox "An error was encountered."
     'Print "Error: " Error(), "   Err:" Err(), " Erl:" Erl()
If Err=213 Then
Messagebox Filename & " was not found. Verify Path and Filename, then try the Import again."
Exit Sub
Else
Messagebox "Error" & Str(Err) & ": " & Error$
End If
Resume Next
SubClose:
xlApp.activeworkbook.close
xlApp.Quit
Set xlapp = Nothing
Set view=db.getview("DeineView")
Call ws.viewrefresh

End Sub
--- Ende Code ---

Jan Th.:
....mmmm mit dem Dokument hat das leider nicht geklappt.

und die Aktion von Klauss läuft und list die Datensätze, aber wenn er fertig ist bekomme ich die Fehlermeldung "Error 6 overflow"

wie muss ich denn die felder in der maske definieren? ich habe das auch schon mit einer .col datei versucht, aber das hat auch nicht richtig funktioniert. ???

Navigation

[0] Themen-Index

[#] Nächste Seite

[*] Vorherige Sete

Zur normalen Ansicht wechseln