|
希望能够帮助到你:
- Sub byWanao()
- Dim oDoc As Object, myPath$, f As Object, k&, i&
- Range("A1:E1") = Array("转速", "比例不匹配排名", "垂直度排名", "间隙X排名", "间隙Y排名")
- i = 1
- Set oDoc = CreateObject("MSXML2.DOMDocument")
- For Each f In CreateObject("scripting.filesystemobject").getfolder(ThisWorkbook.Path & "\提取").Files
- i = i + 1
- k = 0
- oDoc.Load f.Path
- Dim oErr As Object
- If oDoc.parseError.ErrorCode <> 0 Then
- Set oErr = oDoc.parseError
- Debug.Print oErr.reason
- End If
- Dim oVariables As Object
- Dim oVariable As Object
- Set oVariables = oDoc.SelectNodes("/TEST_DOCUMENT/TEST_SPEC/INSTRUMENT/DYNAMIC_BALLBAR/PROGRAMMED_FEEDRATE")
- Cells(i, k) = oVariables.Item(0).Text
- Set oVariables = oDoc.SelectNodes("/TEST_DOCUMENT/ANALYSIS/FEATURE")
- For Each oVariable In oVariables
- Select Case oVariable.Attributes(0).nodeTypedValue
- Case "AF_SCALE_MISMATCH_RANK", "AF_SQUARENESS_RANK", "AF_LATERAL_PLAY_A_RANK", "AF_BACKLASH_B_RANK"
- k = k + 1
- Cells(i, k) = oVariable.Text
- End Select
- Next
- Next
- End Sub
复制代码
准备学XML的xPath解析,还请大佬多提宝贵建议。
如果可能的话,请大佬提供一些相关的学习资料,万分感谢!!!! |
|