excel in eine maske importieren...

  • Folgendes....


    ..ich habe eine Datenbank mit bestimmten Feldern...
    ....ich habe eine Excel Tabelle mit mehreren Datensätzen....die möchte ich in Datenbank importieren...


    ...und wie mache ich das????


    :-? Holja :-?

    -----------------------------------------------------------------------------------------
    Warum sind die Dummen so selbstsicher, und die Klugen so zweifelnd?

  • zum Bleistift:


    Agent mit LS


    Declarations:


    Type ColStruc
    FieldName As String
    FieldDelimiter As String
    End Type


    Initialize:


    Sub Initialize



    Dim xlFilename As String

    '// This is the name of the Excel file that will be imported
    xlFilename = "C:\Name.xls"

    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim view As NotesView
    Dim doc As NotesDocument
    Dim row As Integer
    Dim written As Integer
    Set db = session.CurrentDatabase
    Set doc = New NotesDocument(db)

    '// Next we connect to Excel and open the file. Then start pulling over the records.
    Dim Excel As Variant
    Dim xlWorkbook As Variant
    Dim xlSheet As Variant
    Print "Connecting to Excel..."
    Set Excel = CreateObject( "Excel.Application.8" )
    Excel.Visible = False '// Don't display the Excel window
    Print "Opening " & xlFilename & "..."
    Excel.Workbooks.Open xlFilename '// Open the Excel file
    Set xlWorkbook = Excel.ActiveWorkbook
    Set xlSheet = xlWorkbook.ActiveSheet

    '// Cycle through the rows of the Excel file, pulling the data over to Notes
    Goto Records
    Print "Disconnecting from Excel..."
    xlWorkbook.Close False '// Close the Excel file without saving (we made no changes)
    Excel.Quit '// Close Excel
    Set Excel = Nothing '// Free the memory that we'd used
    Print " " '// Clear the status line


    Records:
    row = 0 '// These integers intialize to zero anyway
    written = 0

    Print "Starting import from Excel file..."

    Do While True '// We use a test a few lines down to exit the loop
    Finish:
    With xlSheet
    row = row + 1

    Set view= db.GetView("Ansicht")
    Set doc = db.CreateDocument '// Create a new doc
    doc.Form = "Importform"

    doc.Feldname = .Cells( row, 1).Value
    doc.Feldname = .Cells(row, 2).Value
    doc.Feldname = .Cells(row, 3).Value
    doc.Feldname = .Cells( row, 4).Value
    doc.Feldname = .Cells(row, 5).Value

    Call doc.Save( True, True ) '// Save the new doc

    written = written + 1

    If doc.Feldname(0) = "" Then
    Goto Done
    Else
    End If
    End With

    Print written & " records imported...", doc.LastName(0)


    Loop
    Return
    Done:
    End Sub


    Hab ich mal im Internet gefunden. Bei Spalte einfach die benötigten Spalten-Nr. eingeben, man kann auch eine Spalte überspringen und bei Feldname die Feldnamen Deiner Maske einsetzen.
    gruß
    rubbeldidup

  • Speichern als WK4 datei in Excel. Reinfolge der felder merken (aufschreiben)
    Ein ansicht mit diesen reinfolge machen (denk an den spaltenbreidte)
    Import der wk4 datei machen...


    Fertig