Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

SingleSelectNode with CustomXML in Word

$
0
0

I have some CustomXML data in a Word document that I'm trying to reference in VBA.  I have got as far as loading the XML part, but can't get the specific value out.

XML:

<?xml version="1.0"?><?mso-infoPathSolution solutionVersion="1.0.0.3" productVersion="14.0.0" PIVersion="1.0.0.0" href="http://portal-mysites/personal/adamh/Personal%20Documents/PropTest.xsn" name="urn:schemas-microsoft-com:office:infopath:PropTest:-myXSD-2013-07-01T14-47-53" ?><?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.3"?><my:myFields xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2013-07-01T14:47:53"><my:tCompany>AnyCharity</my:tCompany><my:tCharity>true</my:tCharity><my:tEthernet>false</my:tEthernet><my:tContact>ANOther</my:tContact></my:myFields>

Macro code:

Sub TestPropMac()    Dim myPart As CustomXMLPart     Dim oNode As CustomXMLNode     Set myPart = GetXMLPartByRoot_Element(ActiveDocument, "myFields")     MsgBox myPart.XML           'Read node 1     Set oNode = myPart.SelectSingleNode("myFields/tCharity")     MsgBox oNode.NodeValueEnd Sub

As you can see, I'm using MsgBox to confirm I've reached the data (which I haven't) - I intend to use an If statement against the value for another function.

Any ideas very gratefully received!


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>