共用方式為


Office) (CustomXMLPart.SelectNodes 方法

會從自訂 XML 組件選取節點集合。

語法

運算式SelectNodes (XPath)

表達 會傳回 CustomXMLPart 物件的運算式。

參數

名稱 必要/選用 資料類型 描述
XPath 必要 String 含有 XPath 運算式。

傳回值

CustomXMLNodes

範例

下列範例示範如何新增自訂的 XML 組件、選取符合命名空間 URI 的組件,然後在該組件內選取符合 XPath 運算式的節點。

Dim cxp1 As CustomXMLPart 
Dim cxn As CustomXMLNode 
 
' Add a custom xml part. 
ActiveDocument.CustomXMLParts.Add "<supplier>" 
 
' Return the first custom xml part with the given namespace. 
Set cxp1 = ActiveDocument.CustomXMLParts("urn:invoice:namespace")  
 
' Get all of the nodes matching an XPath expression. 
 Set cxns = cxp1.SelectNodes("//*[@unitPrice > 20]") 

另請參閱

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應