I'm trying to pull specific data from XML files using XBRL structure. An example XML file is here
Index of /Archives/edgar/data/104169/000010416912000018
file: 0000104169-12-000018-xbrl.zip
(it's a Walmart financial filing from 31oct2012)
My understanding is that once that file is downloaded it's possible to pull specific bits of data using VB. I know very little about XML parsing and search but two sources I've found suggest a simple sub similar to the following. However I'm getting Run-time error 91 and I can't undrstand why the object variable isn't set. Does anyone see an obvious error in this?
Index of /Archives/edgar/data/104169/000010416912000018
file: 0000104169-12-000018-xbrl.zip
(it's a Walmart financial filing from 31oct2012)
My understanding is that once that file is downloaded it's possible to pull specific bits of data using VB. I know very little about XML parsing and search but two sources I've found suggest a simple sub similar to the following. However I'm getting Run-time error 91 and I can't undrstand why the object variable isn't set. Does anyone see an obvious error in this?
Code:
Sub GetXBRLData()
Dim LOADFILE As String
LOADFILE = "'path to file'\wmt-20121031.xml" 'xml instance document
Dim CONCEPT As String
CONCEPT = "us-gaap:AccountsPayableCurrent"
Dim CONTEXT As String
CONTEXT = "I2013Q3"
Dim oDocument As MSXML2.DOMDocument30
Set oDocument = New MSXML2.DOMDocument30
oDocument.async = False
oDocument.validateOnParse = False
oDocument.Load (LOADFILE)
Dim FACTVALUE As String
FACTVALUE = oDocument.SelectSingleNode("/" & CONCEPT & "[@contextref='" & CONTEXT & "']").Text
MsgBox FACTVALUE
Set oDocument = Nothing
End Sub