Page 1 sur 1

récupérer les données d'un fichier Excel dans un fiormulaire

MessagePublié: 09 Oct 2002 à 14:48
par nicolas
A ce jour ... il existe un fichier excel avec des enregistrements ...On me demande de récupérer les enregistremnts dans un formulaire notes ... sans les resaisir bien sûr ...Comment je peut importer les données d'un fichier excel et les enregistrer dans mon formulaire ... ?

Re: récupérer les données d'un fichier Excel dans un fiormul

MessagePublié: 10 Oct 2002 à 11:38
par patrick
Bonjour,il te suffit d'enregistrer ton fichier au format Lotus 123 (.wk4).Ensuite tu construis un fichier .col (voir l'aide designer) dans lequel tu fais correspondre tes colonnes à tes champs Notes. Tu peux même spécifier une formule (pour faire des convertions ou dblookup).Une fois les deux fichiers créer, tu vas dans ta base et tu choisis file\importTu sélectionnes le Wk4Tu choisis le masqueTu sélectionnes l'option fichier de format en spécifiant le .colET voilà tu auras un nouveau document par ligne de ton fichier Excel...

Re: récupérer les données d'un fichier Excel dans un fiormul

MessagePublié: 10 Oct 2002 à 13:20
par charles
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

Re: récupérer les données d'un fichier Excel dans un fiormul

MessagePublié: 10 Oct 2002 à 15:06
par charles
c'est de la balle ... !!Tu es le meilleur !!!!MERCI ....