vba 读取 xml数据

 

 
    Dim xDoc As New DOMDocument30
    Dim root As IXMLDOMElement
    Dim s As String
    Dim j As Integer, N As Integer
    xDoc.async = False
   '获取数据
    xDoc.loadXML (strXml)
    'xDoc.load(xmlFileName) 'c:\test.xml
    N = xDoc.documentElement.childNodes.Length
    
    Dim x As IXMLDOMNode
    
    For j = 0 To N - 1

      Set root = xDoc.documentElement.childNodes(j)
        
         For Each x In root.childNodes
             
             x.Attributes(0).text '第一个属性的值

         Next

     Next j

 

你可能感兴趣的:(xml)