Hi,
This could be the wrong forum, but it is a follow on to an earlier question I posted here about the WordOpenXML string defined by a Word rich text content control.
I am basically trying to get access to the "body" node of the XML. I added the XML as a customXMLPart to a word document and then used my CC Mapping Tool add-in to determine the xPath of the node of interest. That is shown in my code
below. However, when I run this code I am getting an error about an undefined namespace reference.
For the code to work, you need a reference to the Microsoft Office XML 6.0 object library and a document containing a single rich text content control containing text.
Can anyone assist with the correct XPath statement to access this node or how to define the missing ns references that the complier complains about?
My ultimate goal (perhaps fruitless) is to attempt to create a rich text CC change event. If I can get a manageable chuck of string text to continuously compare with a reference chunk of sting text then viola. The problem appears to be constantly
changing rsid values in the WordOpenXML string. If I can isolate just the "body" string and strip out those rsid values then I may have some success.
Thanks.
Sub ScratchMacro() Dim oXDoc As New MSXML2.DOMDocument Dim oNode As MSXML2.IXMLDOMNode oXDoc.LoadXML (ActiveDocument.ContentControls(1).Range.WordOpenXML) oXDoc.setProperty "SelectionLanguage", "XPath" Set oNode = oXDoc.SelectSingleNode("/ns0:package[1]/ns0:part[3]/ns0:xmlData[1]/ns11:document[1]/ns11:body[1]") End Sub
Greg Maxey Please visit my website at: http://gregmaxey.mvps.org/word_tips.htm