importer xml multiple table vers excel
bonjour tout le monde
j'ai un fichier xml où il y a beaucoup de table (voici un exemple avec deux tables: DB et VILLE)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| <DB>
<id>1</id>
<nom>PAUL</nom>
</DB>
<DB>
<id>2</id>
<nom>JACQUE</nom>
</DB>
<DB>
<id>2</id>
<nom>ALINE</nom>
</DB>
<VILLE>
<id>1</id>
<N_VILLE>PARIS</N_VILLE>
</VILLE>
<VILLE>
<id>1</id>
<N_VILLE>LYON</N_VILLE>
</VILLE>
<VILLE>
<id>1</id>
<N_VILLE>NIME</N_VILLE>
</VILLE> |
je veux importer chaque table dans une feuille Excel
j'arrive à importer toutes les tables dans la même feuille
par le code suivant:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| Sub ImporterFichierXML()
Dim XM As XmlMap
'Importe le fichier dans la cellule B1 de la Feuil3.
ThisWorkbook.XmlImport _
URL:="D:fille.xml", _
ImportMap:=Nothing, _
Overwrite:=True, _
Destination:=Worksheets("Feuil1").Range("$B$1")
'Définit le mappage qui vient d'être ajouté.
'ThisWorkbook.XmlMaps.Count correspond au dernier xml mappé dans le classeur
Set XM = ThisWorkbook.XmlMaps(ThisWorkbook.XmlMaps.Count)
MsgBox "Import terminé" & vbCrLf & _
XM.RootElementName & vbCrLf & _
XM.Name & vbCrLf & _
XM.DataBinding.SourceUrl
End Sub |
merci de votre aide