'VBA: Excel to XML

I have multiple Excel sheets with the same schema.

I tried to record a macro but the code didn``'t mapped the cells to the coresponding fields in the Map.

The schema has a:

Root with 6 elements from A2 to F2

Root with 3 elements from E5 to C5

And a Root with a table from A7:F12

This is the recorded macro:

Sub Macro1()
    ActiveWorkbook.XmlMaps.Add( _
        "C:\Users\baulli01\OneDrive - TMF Group\Desktop\IIBBB mapa.xml", _
        "ddjjSifereWeb").Name = "ddjjSifereWeb_Map"
    Columns("F:F").EntireColumn.AutoFit
    Cells.Select
    Selection.Columns.AutoFit
    Cells.Select
    Selection.Columns.AutoFit
    Range("D8").Select
    ActiveWorkbook.XmlMaps("ddjjSifereWeb_Map").Export Url:= _
        "C:\Users\baulli01\OneDrive - TMF Group\Desktop\xml m.xml"
    ActiveWorkbook.XmlMaps("ddjjSifereWeb_Map").Delete
End Sub

I will appreciate any help on how to add the cells to the map.

Thank you.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source