Exporter un fichier de données vers excel ou sql

yghilas Messages postés 2 Date d'inscription jeudi 11 septembre 2003 Statut Membre Dernière intervention 16 janvier 2012 - 6 janv. 2012 à 22:29
cs_Le Pivert Messages postés 7893 Date d'inscription jeudi 13 septembre 2007 Statut Contributeur Dernière intervention 19 mai 2023 - 7 janv. 2012 à 12:23
Bonjour à tous,
voilà j'ai un document word ou texte sous cette forme ou chaque ISN est un enregistrement

ISN=6
B100 NUMERO : 6
B200 LANGUE : IT
FR
B300 CLASSE : 270
B400 COTE : 52003
B600 TITRE : ORDO OFFICII RECITANDE ATQUE MISSA CELEBRANDPE
C100 FORMAT : 21
C200 PAGE : 46
C400 ANNEE : 1867


ISN=7
B100 NUMERO : 7
B200 LANGUE : IT
FR
B300 CLASSE : 270
B400 COTE : 52003
B600 TITRE : ORDO OFFICII RECITANDI ATAQUE MISSA CELEBRANDE
C100 FORMAT : 22
C200 PAGE : 96
C400 ANNEE : 1856


ISN=9
B100 NUMERO : 9
B200 LANGUE : FR
B300 CLASSE : 270
B400 COTE : 52003
B600 TITRE : ORDRE DE CREATION DES TITRES ECCLESIASTIQUES
C100 FORMAT : 21
C200 PAGE : 35
C400 ANNEE : 1854


ISN=10
B100 NUMERO : 1243
B200 LANGUE : IT
FR
B300 CLASSE : 270
B400 COTE : 52003
B600 TITRE : ORDO OFFICII RECITANDI MISSAEQUE CELEBRANDEA
C100 FORMAT : 21
C200 PAGE : 42
C400 ANNEE : 1874



j'ai des centaines de milliers d'enregistrements, je veux convertir ce fichier en base de données ou à la limite en fichier excel


alors help svp

1 réponse

cs_Le Pivert Messages postés 7893 Date d'inscription jeudi 13 septembre 2007 Statut Contributeur Dernière intervention 19 mai 2023 136
7 janv. 2012 à 12:23
Bonjour,
Je te propose une solution avec vba Word
Tu mets dans un dossier le doc que tu veux copier et un classeur Excel nommé pour l'occasion "essai" fermé. Ensuite tu vas dans le vbe de ton doc Word tu inseres un UserForm dans lequel tu mets un button avec ce code:

'cochez la référence Microsoft Excel, 11.0 Object Library
Private Sub CommandButton1_Click()
 'selection du texte
 Selection.WholeStory
    Selection.Copy
'coller dans Excel
 Dim objExcel As New Excel.Application
    Dim wb As Excel.Workbook
    Set wb = objExcel.Workbooks.Open(ThisDocument.Path & "" & "essai" & ".xls") 'ouvre le classeur Excel
  With wb.Sheets(1)
       .Paste
        End With
      objExcel.Quit
End Sub



J'ai essayé cela fonctionne, après tu peux l'améliorer
@+ Le Pivert
0