0

I use this simple sub on access 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

When run i recive a 91 runtime error

braX
  • 11,506
  • 5
  • 20
  • 33
IfThenElse
  • 485
  • 5
  • 13

1 Answers1

0

XPath in selectSingleNode()should be “A/B” (forward slash, not the backslash you used)

BankBuilder
  • 466
  • 2
  • 10