Donnees Excel vers XML via VBA
Bonjour,
J'ai reussi a convertir mes donnees excel 2003 en fichier xml, chez moi; mais au bureau, le fichier xml cree est vide.
Pourriez-vous m'aider, svp?
Merci d'avance
Code:
Option Explicit
Option Base 1
Sub XMLmarkers()
Dim xmlDoc As MSXML2.DOMDocument
Dim xmLstring As String, File As String, strQuote As String
Dim Row As Integer, Col As Integer
Dim Attribut As Variant
strQuote = """"
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmLstring = "<?xml version=""1.0"" encoding=""utf-8"" ?> "
xmLstring = xmLstring & "<Markers TitleName=" & strQuote _
& "markers" & strQuote & "> "
Attribut = Array("Lat", "Lng", "Postcode", "Address", "Name", "Category", "Description")
For Row = 2 To Sheets("Sheet1").UsedRange.Rows.Count
xmLstring = xmLstring & "<marker "
For Col = 1 To 7
xmLstring = xmLstring & Attribut(Col) & "=" & _
strQuote & Cells(Row, Col) & strQuote & " "
Next
xmLstring = xmLstring & " />"
xmLstring = xmLstring & " "
Next Row
xmLstring = xmLstring & "</Markers>"
xmlDoc.loadXML xmLstring
File = "C:\Users\Tex'Ance\Desktop\test2.xml"
xmlDoc.Save (File)
End Sub