Public Sub RHTable(ByVal CCtag As String, ByVal xPath As String)
Dim curConControl As ContentControls
Set curConControl = ActiveDocument.SelectContentControlsByTag(CCtag)
Dim tableInfo As Word.Table
tablestring = ""
Dim xDoc As MSXML2.DOMDocument
Set xDoc = New MSXML2.DOMDocument
If Not xDoc.Load(xml) Then
Err.Raise xDoc.parseError.ErrorCode, , xDoc.parseError.reason
End If
Dim list As IXMLDOMNodeList
Set list = xDoc.SelectNodes(xPath)
Dim attr As IXMLDOMAttribute
Dim node As IXMLDOMNode
Dim childNode As IXMLDOMNode
For Each node In list
If node.HasChildNodes = True Then
For Each childNode In node.ChildNodes If childNode.HasChildNodes = True Then
For Each Child In childNode.ChildNodes
If Child.Text <> "" Then
If StrComp(Child.BaseName, "COLUMN_1", 1) = 0 Then
' Debug.Print Child.Text
tablestring = tablestring & Replace(Child.Text, "***********", "****")
Else
' Debug.Print Child.Text
tablestring = tablestring & ":" & Replace(Child.Text, "***********", "****")
End If
End If
Next Child
End If
' Debug.Print vbCrLf
tablestring = tablestring & vbCrLf
Next childNode
End If
Next node
With curConControl(1)
' Debug.Print Len(tablestring)
If Len(tablestring) > 2 Then
.Range.Text = tablestring
Else
ActiveDocument.Range(.Range.Start - 1, .Range.End + 2).Select
Selection.Delete
End If
End With
End Sub