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
| Sub TestXML()
Dim Doc_XML As Object
Dim Root As Object
Dim Node As Object
Dim Name As Object
Dim Chemin As String 'Chemin de sauvegarde
Set Doc_XML = CreateObject("MSXML2.DOMDocument")
Set Node = Doc_XML.CreateProcessingInstruction("xml", "version=""1.0"" encoding=""ISO-8859-1""")
Doc_XML.appendChild Node
Set Root = Doc_XML.CreateElement("diffusion")
Root.setAttribute "client_id", "1234"
Root.setAttribute "diff_id", "123456"
Root.setAttribute "mail_error", "exemple@test.fr"
Root.setAttribute "lang_error", "en"
Doc_XML.appendChild Root
Set Node = Doc_XML.CreateElement("csv")
Node.setAttribute "csvfilename", "test.csv"
Node.setAttribute "Delim", ";"
Root.appendChild Node
Set Node = Nothing
Set Root = Nothing
Chemin = ThisWorkbook.Path & "\FichierDeSortie.xml"
Doc_XML.Save Chemin
End Sub |
Partager