Discussion:
SelectNodes not working no matter what I try
(too old to reply)
jerryw
2005-10-26 09:55:05 UTC
Permalink
Sub Tst6()
Dim MyXMLDoc As New DOMDocument40
Dim neCells As IXMLDOMNodeList
MyXMLDoc.Load "c:\ExcelXML1.xml"
MyXMLDoc.setProperty "SelectionLanguage", "XPath"
MyXMLDoc.setProperty "SelectionNamespaces",
"xmlns:w='urn:schemas-microsoft-com:office:spreadsheet'"
Set neCells = MyXMLDoc.selectNodes("//w:cell")
MsgBox neCells.Length
End Sub

Based on everything I see, this code should work on an Excel
spreadsheet saved as XML but nothing I try gets cells, worksheets,
workbooks, etc.

Please advise.

Thank you.
Martin Honnen
2005-10-26 12:39:06 UTC
Permalink
Post by jerryw
Sub Tst6()
Dim MyXMLDoc As New DOMDocument40
Dim neCells As IXMLDOMNodeList
MyXMLDoc.Load "c:\ExcelXML1.xml"
MyXMLDoc.setProperty "SelectionLanguage", "XPath"
MyXMLDoc.setProperty "SelectionNamespaces",
"xmlns:w='urn:schemas-microsoft-com:office:spreadsheet'"
Set neCells = MyXMLDoc.selectNodes("//w:cell")
MsgBox neCells.Length
End Sub
Based on everything I see, this code should work on an Excel
spreadsheet saved as XML but nothing I try gets cells, worksheets,
workbooks, etc.
XML is case sensitive (and XPath of course too) and I am sure the
element name is Cell and not cell so change your XPath to
//w:Cell
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Loading...