par charles » 10 Oct 2002 à 13:20
j'ai ce qu'il te faut ..Crois moi .... Hasta la vista ! ! Sub initializeDim xlFilename As StringxlFilename = "c:\temp\motient.xls" Dim session As New NotesSessionDim db As NotesDatabaseDim view As NotesViewDim doc As NotesDocumentSet db = session.CurrentDatabaseSet doc = New NotesDocument(db)Dim One As StringDim row As LongDim written As LongDim Excel As VariantDim xlWorkbook As VariantDim xlSheet As VariantPrint "Connecting to Excel..."Set Excel = CreateObject( "Excel.Application" )Excel.Visible = False '// Don't display the Excel windowPrint "Opening " & xlFilename & "..."Excel.Workbooks.Open xlFilename '// Open the Excel fileSet xlWorkbook = Excel.ActiveWorkbookSet xlSheet = xlWorkbook.ActiveSheetPrint "Disconnecting from Excel..."xlWorkbook.Close False Excel.Quit Set Excel = Nothing '// Free the memory that we'd usedPrint " " Records:row = 0 written = 0Print "Starting import from Excel file..."Do While True Finish: With xlSheetrow = row + 1Set view = db.GetView("Motient Zip")Set doc = db.CreateDocument doc.Form = "Motient Zip"doc.zipcode = .Cells( row, 1 ).ValueIf .Cells(row,1).Value="" ThenGoto DoneEnd Ifdoc.state = .Cells(row, 2 ).Valuedoc.name = .Cells(row, 3 ).Valuedoc.ib = .Cells(row, 4).Valuedoc.os = .Cells(row, 5 ).Valuedoc.ziptype = .Cells(row, 6 ).Valuedoc.enclosingzip = .Cells(row, 7 ).ValueCall doc.Save( True, True ) written = written + 1'If written = 100 ThenPrint written 'Print written & "record stopped at..", doc.(0), doc.Verð(0) 'ans$ = Inputbox$("Do you want to continue, Y/N?")' If ans$ = "Y" Or ans$ ="y" Then' Goto Finish' Else'Goto Done' End If'End If' End IfEnd WithLoopReturnDone:Print "Disconnecting from Excel..."xlWorkbook.Close False Excel.Quit Set Excel = NothingEnd Sub