ms-access vba上的selectSingleNode问题

问题描述 投票:0回答:1

我在访问vba时使用这个简单的子

Public Sub ReadXml()
    ' XML FILE:
    ' <A>
    '     <B>sometext</B>
    ' </A>
    Dim n As New MSXML2.DOMDocument60
    Dim n1 As MSXML2.IXMLDOMNode
    Const NomeFile = "C:\file.xml"
    n.async = False
    n.validateOnParse = False
    If n.Load(NomeFile) Then
        Set n1 = n.selectSingleNode("A/B")
        Debug.Print n1.Text ' <===  error
    End If
End Sub

运行时,我收到91运行时错误

xml access-vba domdocument msxml2
1个回答
0
投票

qazxswpo中的XPath应该是“A / B”(正斜杠,而不是你使用的反斜杠)

© www.soinside.com 2019 - 2024. All rights reserved.