EDN Admin
Well-known member
Can someone help me figure this problem out please? When I run my vba 6.0 code, I get good results for nodes, until I get a "is nothing". All subsequent nodes are "is nothing" as well, unless and until I reload the XML file. I dont
want to reload the file all the time, because it drastically slows down the processing speed. Below is my code:
Dim oNodeList As IXMLDOMSelection<br/>
Dim oDocument As MSXML2.DOMDocument<br/>
Set oDocument = New MSXML2.DOMDocument<br/>
Dim mnode As MSXML2.IXMLDOMNode<br/>
oDocument.async = False<br/>
oDocument.validateonparse = False
XMLFile = "C:us-gaap-doc-2011-01-31.xml"
oDocument.Load (XMLFile)
for each cell in rangeA
ElementName = Trim(Right(CellValue, Len(CellValue) - InStr(1, CellValue, ":", vbTextCompare)))
Set mnode = oDocument.SelectSingleNode("/link:linkbase/link:labelLink/link:label[@xlink:label=lab_" & ElementName & " and @xlink:role=http://www.xbrl.org/2003/role/documentation]")
If IsNull(mnode) Or mnode Is Nothing Then<br/>
oDocument.Load (XMLFile) This is the code that I dont want to have, because
it slows it down too much<br/>
Else<br/>
ElementDefinition = mnode.Text<br/>
End If
cells(a, b).value = ElementDefinition
next cell
View the full article
want to reload the file all the time, because it drastically slows down the processing speed. Below is my code:
Dim oNodeList As IXMLDOMSelection<br/>
Dim oDocument As MSXML2.DOMDocument<br/>
Set oDocument = New MSXML2.DOMDocument<br/>
Dim mnode As MSXML2.IXMLDOMNode<br/>
oDocument.async = False<br/>
oDocument.validateonparse = False
XMLFile = "C:us-gaap-doc-2011-01-31.xml"
oDocument.Load (XMLFile)
for each cell in rangeA
ElementName = Trim(Right(CellValue, Len(CellValue) - InStr(1, CellValue, ":", vbTextCompare)))
Set mnode = oDocument.SelectSingleNode("/link:linkbase/link:labelLink/link:label[@xlink:label=lab_" & ElementName & " and @xlink:role=http://www.xbrl.org/2003/role/documentation]")
If IsNull(mnode) Or mnode Is Nothing Then<br/>
oDocument.Load (XMLFile) This is the code that I dont want to have, because
it slows it down too much<br/>
Else<br/>
ElementDefinition = mnode.Text<br/>
End If
cells(a, b).value = ElementDefinition
next cell
View the full article