Jel,
That seems to work but now I want to delete the node I selected. So I get the parent and use removechild. That is not working as well. I don't want to delete all nodes that are of the type Item, just the one I selected.
I've been reviewing the docs on msdn but it's just not making alot of sence. Is there another site that has better docs to learn from ?
Below is the revised code. What do you think ?
Public Sub DeleteItem(strPath As String, strFileName As String, strDeleteVal As String)
Dim i As Integer
Dim ItemNode As MSXML2.IXMLDOMNode
Dim ItemParent As MSXML2.IXMLDOMNode
Dim ItemNodes As MSXML2.IXMLDOMNodeList
Dim mXDoc As New MSXML2.DOMDocument30
On Error GoTo ErrHandler
mXDoc.Load strPath & "\" & strFileName
mXDoc.setProperty "SelectionLanguage", "XPath"
Set ItemNode = mXDoc.selectSingleNode("CDSListBox/Item[text()=" & "'" & strDeleteVal & "'" & "]")
'Get the parent and delete the node just selected
If Not ItemNode Is Nothing Then
Set ItemParent = ItemNode.parentNode
ItemParent.removeChild (ItemNode)
End If
Stop
ErrHandler:
End Sub
Thanks,
MFZ