I'm a bit of a novice (both on this site and coding in general) so please bear with me. I have an XML document that looks like this:
<?xml version="1.0" encoding="UTF-8"?>
-<LearnerFirstTimeRegistration xmlns="urn:learnerregfeedback-schema">
-<Header>
-<Record type="1">
<Filename>blahblahblah.xml</Filename>
<ProvinceID>5</ProvinceID>
<EmisNumber>5xxxxxxx8</EmisNumber>
<StatusID>2</StatusID>
<TransactionCategoryID>4</TransactionCategoryID>
<SequenceNumber>1</SequenceNumber>
<DateCreated>2014-02-26</DateCreated>
<CreatedBy>blahblahblah</CreatedBy>
</Record>
</Header>
-<LearnerInformation> .... etc etc
Using VBA I am simply trying to display in a msgbox the value in SequenceNumber node (in this case =1)
I'm using:
Private Sub Command317_Click()
Dim objNodeList As IXMLDOMNodeList
Dim objNode As IXMLDOMNode
Dim xDoc As MSXML2.DOMDocument30
Set xDoc = New MSXML2.DOMDocument30
xDoc.LoadXML ("\\location\blahblahblah.xml")
MsgBox xDoc.selectSingleNode("SequenceNumber").nodeName
End Sub
It is giving me a run time error: object variable or with block variable not set From what i've read around the net it seems to suggest that its because its trying to return a null value. but as you can see, SequenceNumber is not null, its 1.
Any help would be much appreciated