S
SHC
Hi all,
I copied the Bisual Basic code of MSXML IXMLDOMNodeList from MSDN and
adopted it to my Microsoft Access 2003 for VBA execution.
I ran the attached MSXML code in my Access2003 Module and I got: Microsoft
Visual Basic Run-time error '13' - Type mismatched. This error lies in the
following code:
Set str = "The node list has " & objNodeList.length & _
" item." & & vcCrLf
Please help and advise me how to correct the error in my coding and make it
working for me.
Thanks in advance,
SHC
///////----Module1---////////
Sub getNodeList()
' The following Microsoft® Visual Basic® example uses books.xml
' to create an IXMLDOMNodeList and display its XML.
' Supports iteration through the live collection, in addition to
' indexed access.
Dim xmlDoc As New MSXML2.DOMDocument50
Dim currNode As IXMLDOMNode
Set xmlDoc = New MSXML2.DOMDocument50
xmlDoc.async = False
xmlDoc.Load ("C:\MSXML-msdn\books.xml")
If (xmlDoc.parseError.errorCode <> 0) Then
Dim myErr
Set myErr = xmlDoc.parseError
MsgBox ("You have error " & myErr.reason)
Else
Set objNodeList = xmlDoc.getElementsByTagName("author")
Dim str
Set str = "The node list has " & objNodeList.length & _
" items." & vbCrLf
MsgBox (str)
Dim x As Long
x = 1
For x = 1 To objNodeList.length
str = str & CStr(x) & ": " & objNodeList.Item(x - 1).XML & vbCrLf
Next
MsgBox str
End If
End Sub
I copied the Bisual Basic code of MSXML IXMLDOMNodeList from MSDN and
adopted it to my Microsoft Access 2003 for VBA execution.
I ran the attached MSXML code in my Access2003 Module and I got: Microsoft
Visual Basic Run-time error '13' - Type mismatched. This error lies in the
following code:
Set str = "The node list has " & objNodeList.length & _
" item." & & vcCrLf
Please help and advise me how to correct the error in my coding and make it
working for me.
Thanks in advance,
SHC
///////----Module1---////////
Sub getNodeList()
' The following Microsoft® Visual Basic® example uses books.xml
' to create an IXMLDOMNodeList and display its XML.
' Supports iteration through the live collection, in addition to
' indexed access.
Dim xmlDoc As New MSXML2.DOMDocument50
Dim currNode As IXMLDOMNode
Set xmlDoc = New MSXML2.DOMDocument50
xmlDoc.async = False
xmlDoc.Load ("C:\MSXML-msdn\books.xml")
If (xmlDoc.parseError.errorCode <> 0) Then
Dim myErr
Set myErr = xmlDoc.parseError
MsgBox ("You have error " & myErr.reason)
Else
Set objNodeList = xmlDoc.getElementsByTagName("author")
Dim str
Set str = "The node list has " & objNodeList.length & _
" items." & vbCrLf
MsgBox (str)
Dim x As Long
x = 1
For x = 1 To objNodeList.length
str = str & CStr(x) & ": " & objNodeList.Item(x - 1).XML & vbCrLf
Next
MsgBox str
End If
End Sub