dynamicsearch数据在具有VBA的XML文件中

我需要在Excel中打开VBA中的XML文件。 我在XML文件中查找的是两个string,它们是标签。 这些string可以在多个标签下find,我也需要连接它们。

<Systems> <conveyor ConveyorNumber="132000"> <conveyor>132000</conveyor> <productName>IQ</productName> </conveyor> </Systems> 

那里有更多的数据,但我只需要

 <conveyor>132000</conveyor> 

 <productName>IQ</productName> 

。 有多个

 <Systems></Systems> 

在文件中,所以我需要统计文件中的系统连接所需的两个string,并将它们全部放在Excel工作表的一列中。 有没有办法做到这一点?

尝试下面的代码来parsingXML文件

 Sub parseXML() Dim strPath As String strPath = Application.GetOpenFilename Dim XDoc As Object Set XDoc = CreateObject("MSXML2.DOMDocument") XDoc.async = False XDoc.validateOnParse = False XDoc.Load (strPath) Set xObjDetails = XDoc.ChildNodes(0) Set xObject = xObjDetails.FirstChild For Each xObject In xObjDetails.ChildNodes MsgBox "Child nodes count " & xObjDetails.ChildNodes.Length For Each xChild In xObject.ChildNodes MsgBox xChild.BaseName & " " & xChild.Text Next xChild Next xObject End Sub