Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with xPath - SearchNodes not returning any nodes

Hi,

I'm trying to write a macro that determines which worksheet corresponds to which file in xl/worksheets. I found an example on the web, but the SelectNodes method doesn't seem to return any nodes as the for loop just skips without stopping. I can't really find a decent description of how to use the xPath syntax.

Any help much appreciated.


VBA

Public Sub GetSheetFileNameFromId()
Dim oXMLDoc As MSXML2.DOMDocument60
Dim oXMLNode As MSXML2.IXMLDOMNode
Dim oXMLNodeList As MSXML2.IXMLDOMNodeList
Set oXMLDoc = New MSXML2.DOMDocument60
oXMLDoc.async = False
oXMLDoc.Load "C:\Users\gapage\Documents\VBA and Tools\Unzipped Deprectiation.xlsx.zip\xl\_rels\workbook.xml.rels"

Set oXMLNodeList = oXMLDoc.SelectNodes("/Relationships/Relationship")
For Each oXMLNode In oXMLNodeList
Debug.Print oXMLNode.NodeValue

Next
End Sub

XML code

<?xml version="1.0" encoding="UTF-8" standalone="true"?

-<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"

<Relationship Target="worksheets/sheet3.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Id="rId3"/

<Relationship Target="calcChain.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain" Id="rId7"/

<Relationship Target="worksheets/sheet2.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Id="rId2"/

<Relationship Target="worksheets/sheet1.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Id="rId1"/

<Relationship Target="sharedStrings.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Id="rId6"/

<Relationship Target="styles.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Id="rId5"/

<Relationship Target="theme/theme1.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Id="rId4"/

</Relationships
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,182
Default Help with xPath - SearchNodes not returning any nodes

I'm trying to write a macro that determines which worksheet
corresponds to which file in xl/worksheets.


Are you saying you want to list the sheetnames of all files in a
specific folder like so...

xl\worksheets\
File1.xls
Sheet1
Sheet2

File2.xls
Sheet1
Sheet2
Sheet3
Sheet4
Sheet5
Sheet6

...and so on?

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Do Relative xPath In CustomXMLNode? johnywhy Excel Discussion (Misc queries) 0 January 3rd 11 02:35 AM
How do I add nodes to child nodes of a radial diagram? jmDesktop Excel Programming 0 August 22nd 08 07:36 PM
XML and xpath Kai I. H. Excel Programming 0 February 7th 07 05:26 PM
Returning checked Nodes from Treeview form control Dan Thompson Excel Programming 1 December 14th 04 09:33 AM
Xpath For Xml Map WStoreyII[_2_] Excel Programming 0 August 6th 04 03:11 AM


All times are GMT +1. The time now is 04:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"