When dealing with XML it is ususally best to use Microsofts XML parser to do the reading for you. To run this code I set a reference to Microsoft XML, v3.0 from the list of references. pretty much any version of the parser should work with this code.
VB Code:
Private Sub Command1_Click() Dim objDoc As DOMDocument Dim objNode As IXMLDOMNode 'load the xml document into a document object 'You can use the LoadXML method instead to load an XML string instead of a file Set objDoc = New DOMDocument objDoc.async = False objDoc.Load "C:\Documents and Settings\Mark\Desktop\sample.xml" 'Select the node you want to read and add its text to the label Set objNode = objDoc.selectSingleNode("First/Topic") Label1.Caption = objNode.Text Set objNode = objDoc.selectSingleNode("First/Message") Label2.Caption = objNode.Text 'do your cleanup Set objNode = Nothing Set objDoc = Nothing End Sub




Reply With Quote